curl --request POST \
--url https://guidinghand.ai/v1/tasks/{task_id}/respond \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"question_id": "<string>",
"answer": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({question_id: '<string>', answer: '<string>'})
};
fetch('https://guidinghand.ai/v1/tasks/{task_id}/respond', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://guidinghand.ai/v1/tasks/{task_id}/respond"
payload = {
"question_id": "<string>",
"answer": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"object": "task",
"task_id": "<string>",
"session_id": "<string>",
"agent_id": "<string>",
"status": "queued",
"done": true,
"prompt": "<string>",
"result": "<string>",
"error": "<string>",
"pending": {
"type": "question",
"question_id": "<string>",
"question": "<string>",
"options": [
"<string>"
],
"customer_can_answer": true
},
"cursor": 123,
"metadata": {
"customer_id": "cus_42"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"active_seconds": 123,
"billed_minutes": 123,
"replay_url": "<string>",
"recording": {
"frames": 123
},
"events": [
{
"cursor": 123,
"type": "started",
"message": "<string>",
"ts": "2023-11-07T05:31:56Z",
"data": {}
}
]
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"code": "<string>",
"answered_by": "customer"
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"code": "<string>",
"answered_by": "customer"
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"code": "<string>",
"answered_by": "customer"
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"code": "<string>",
"answered_by": "customer"
}
}Answer a question or approval
When task.pending.type is question, send its question_id and your answer. When it is approval, send its approval_id and a decision. When the person at the computer can answer or decide it too (pending.customer_can_answer, pending.customer_can_approve), the first one is used: a later one returns 409 with code: "already_answered" and answered_by.
curl --request POST \
--url https://guidinghand.ai/v1/tasks/{task_id}/respond \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"question_id": "<string>",
"answer": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({question_id: '<string>', answer: '<string>'})
};
fetch('https://guidinghand.ai/v1/tasks/{task_id}/respond', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://guidinghand.ai/v1/tasks/{task_id}/respond"
payload = {
"question_id": "<string>",
"answer": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"object": "task",
"task_id": "<string>",
"session_id": "<string>",
"agent_id": "<string>",
"status": "queued",
"done": true,
"prompt": "<string>",
"result": "<string>",
"error": "<string>",
"pending": {
"type": "question",
"question_id": "<string>",
"question": "<string>",
"options": [
"<string>"
],
"customer_can_answer": true
},
"cursor": 123,
"metadata": {
"customer_id": "cus_42"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"active_seconds": 123,
"billed_minutes": 123,
"replay_url": "<string>",
"recording": {
"frames": 123
},
"events": [
{
"cursor": 123,
"type": "started",
"message": "<string>",
"ts": "2023-11-07T05:31:56Z",
"data": {}
}
]
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"code": "<string>",
"answered_by": "customer"
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"code": "<string>",
"answered_by": "customer"
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"code": "<string>",
"answered_by": "customer"
}
}{
"error": {
"type": "invalid_request",
"message": "<string>",
"code": "<string>",
"answered_by": "customer"
}
}Authorizations
An org API key (gh_live_…) from Settings → API keys in the console.
Path Parameters
The task’s id.
Body
Response
OK
queued, running, waiting_for_user, waiting_for_approval, completed, failed, stopped The agent’s summary when it finished.
What the agent waits on: answer it with /respond.
- Question
- Approval
Show child attributes
Show child attributes
The latest event’s cursor.
Your own ids and labels (e.g. a ticket or customer id), returned as given.
Show child attributes
Show child attributes
{ "customer_id": "cus_42" }
Time spent running (not waiting on a person).
The replay in the console.
Show child attributes
Show child attributes
With include=events.
Show child attributes
Show child attributes