Introduction

The Airplane API enables customers to further integrate Airplane into their workflows. The API is loosely organized around top-level resources, is more RPC than REST, accepts JSON-encoded bodies, and returns JSON-encoded responses. The current API endpoints allow for programmatic execution of tasks and runbooks.

Getting started

To use the API to execute a task, you first need an API key. Download the Airplane CLI and generate a key by running:
bash
Copied
1
airplane apikeys create <token name>
See Authentication for details.
Once you have your API key, you need to find the slug of the task you wish to run. You can find your task's slug next to the task's name within the task editor or by running airplane tasks list from the CLI. Once you have the task slug, you can execute the task by running the following curl command:
bash
Copied
1
# Substitute YOUR_API_KEY_HERE with your API key
2
curl https://api.airplane.dev/v0/tasks/execute \
3
-X POST \
4
-H "X-Airplane-API-Key: YOUR_API_KEY_HERE" \
5
-d '{
6
"slug": "hello_world",
7
"paramValues": {
8
"limit": "10"
9
},
10
}'
If your team uses Environments, you can specify which environment the request should run against. To do so, add the header X-Airplane-Env-Slug: <YOUR ENV SLUG> to your request. If you do not specify an environment, the default environment will be used.
Executing the task returns a run ID:
json
Copied
1
{
2
"runID": "run20220215zv10o6s52qj"
3
}
You can then use the run ID to check on the status of the run along with other metadata:
bash
Copied
1
curl https://api.airplane.dev/v0/runs/get \
2
-H "X-Airplane-API-Key: YOUR_API_KEY_HERE" \
3
-d 'id=run20220215zv10o6s52qj' \
4
-G