Prompts API

A prompt is used to gather user input during a task's execution. See Prompts to see how prompts are used.

Endpoints

Get Prompt

GET /v0/prompts/get

Get information about an existing prompt.

Get Prompt
Copied
1
curl https://api.airplane.dev/v0/prompts/get \
2
-H "X-Airplane-API-Key: $AIRPLANE_API_KEY" \
3
-d 'id=pmt20221122zyydx3rho2t' \
4
-G

Query Parameters

id
string
REQUIRED

ID of the prompt to retrieve.

Response
Copied
1
{
2
"prompt": {
3
"cancelText": "Reject workflow.",
4
"cancelledAt": "2022-01-11 22:32:46.601486+00",
5
"cancelledBy": "usr20220103zlufhym",
6
"confirmText": "Approve workflow.",
7
"createdAt": "2022-01-11 22:32:45.601486+00",
8
"description": "Prompt workflow description.",
9
"id": "pmt20221122zyydx3rho2t",
10
"reviewers": {
11
"allowSelfApprovals": false,
12
"groups": [],
13
"users": []
14
},
15
"runID": "run20220111zlq2ig4",
16
"schema": {
17
"parameters": [
18
{
19
"component": "textarea",
20
"constraints": {
21
"allowUnknownKeys": false,
22
"optional": false,
23
"options": {},
24
"regex": ""
25
},
26
"default": {},
27
"desc": "Email to use for selecting which user to edit.",
28
"name": "User Email",
29
"parameters": [],
30
"slug": "user_email",
31
"type": "string",
32
"values": {}
33
}
34
]
35
},
36
"submittedAt": "2022-01-11 22:32:46.601486+00",
37
"submittedBy": "usr20220103zlufhym",
38
"values": {
39
"limit": "20",
40
"user": "eric"
41
}
42
}
43
}

Response

prompt
object

Retrieved prompt.

 Show child attributes

List Prompts

GET /v0/prompts/list

List prompts from an existing run.

List Prompts
Copied
1
curl https://api.airplane.dev/v0/prompts/list \
2
-H "X-Airplane-API-Key: $AIRPLANE_API_KEY" \
3
-d 'runID=run20220215zv10o6s52qj' \
4
-G

Query Parameters

runID
string
REQUIRED

ID of the run to retrieve prompts for.

Response
Copied
1
{
2
"prompts": [
3
{
4
"cancelText": "Reject workflow.",
5
"cancelledAt": "2022-01-11 22:32:46.601486+00",
6
"cancelledBy": "usr20220103zlufhym",
7
"confirmText": "Approve workflow.",
8
"createdAt": "2022-01-11 22:32:45.601486+00",
9
"description": "Prompt workflow description.",
10
"id": "pmt20221122zyydx3rho2t",
11
"reviewers": {
12
"allowSelfApprovals": false,
13
"groups": [],
14
"users": []
15
},
16
"runID": "run20220111zlq2ig4",
17
"schema": {
18
"parameters": [
19
{
20
"component": "textarea",
21
"constraints": {
22
"allowUnknownKeys": false,
23
"optional": false,
24
"options": {},
25
"regex": ""
26
},
27
"default": {},
28
"desc": "Email to use for selecting which user to edit.",
29
"name": "User Email",
30
"parameters": [],
31
"slug": "user_email",
32
"type": "string",
33
"values": {}
34
}
35
]
36
},
37
"submittedAt": "2022-01-11 22:32:46.601486+00",
38
"submittedBy": "usr20220103zlufhym",
39
"values": {
40
"limit": "20",
41
"user": "eric"
42
}
43
}
44
]
45
}

Response

prompts
array of object

Retrieved prompts.

 Show child attributes

Cancel Prompt

POST /v0/prompts/cancel

Cancel a prompt.

Cancel Prompt
Copied
1
curl https://api.airplane.dev/v0/prompts/cancel \
2
-X POST \
3
-H "X-Airplane-API-Key: $AIRPLANE_API_KEY" \
4
-d '{
5
"id": "pmt20221122zyydx3rho2t"
6
}'

Body Parameters

id
string
optional

Unique ID of the prompt.

Response
Copied
1
{
2
"id": "pmt20221122zyydx3rho2t"
3
}

Response

id
string

Unique ID of the prompt.

Submit Prompt

POST /v0/prompts/submit

Submit a prompt with a set of parameter values.

Submit Prompt
Copied
1
curl https://api.airplane.dev/v0/prompts/submit \
2
-X POST \
3
-H "X-Airplane-API-Key: $AIRPLANE_API_KEY" \
4
-d '{
5
"id": "pmt20221122zyydx3rho2t",
6
"values": {
7
"limit": "20",
8
"user": "eric"
9
}
10
}'

Body Parameters

id
string
optional

Unique ID of the prompt.

values
key value
optional

Mapping of parameter slug to value. You can find your prompt's parameter slugs on the Airplane runs page or by fetching the prompt via the API.

Response
Copied
1
{
2
"id": "pmt20221122zyydx3rho2t"
3
}

Response

id
string

Unique ID of the prompt.