Run an agent task
Changed onExecute an agent task by ID to generate AI output. The selected task version supplies its saved agent defaults for omitted IQ fields; valid request IQ fields take precedence. Provide the necessary context items and configuration in the request body.
Request
- Base URLhttps://api.jasper.ai
- URLhttps://api.jasper.ai/v1/tasks/{id}/run
- Auth
- API key in header X-API-Key
- or OAuth 2Authorization code: https://api.jasper.ai/oauth2/authorizeToken URL: https://api.jasper.ai/oauth2/token scopes: user
Path parameters
The external ID (agt_…) or internal UUID of the agent task to run
Request body
Example request
{
"contextItems": [
{
"id": "70346737-878b-4329-a4d6-9a054efef508",
"value": [
"Registration reminder email",
"Confirmation email"
]
},
{
"name": "Greeting",
"question": "Who is the person that you want me to greet in the registration reminder email?",
"answer": "John Doe"
}
],
"version": 1,
"toLanguage": "EN-US",
"knowledgeIds": [
"kno_123",
"kno_456"
],
"products": [
{
"productId": "prd_073D2D49094A4AED991A47B614522579",
"attributeIds": [
"atr_535B1EC15F5F41EAB1B400E9ED4077B6"
]
}
],
"attachmentIds": [
"tmp_2ee766eaa4ef48e59da1d9602bfecf2d"
],
"toneId": "ton_2ee766eaa4ef48e59da1d9602bfecf2d",
"audienceId": "aud_123",
"audienceIds": {
"primary": "aud_2ee766eaa4ef48e59da1d9602bfecf2d",
"secondary": [
"aud_7c1f0b9d2e4a4f6b8d3c5a1e9f0b2c4d"
]
},
"styleGuideId": "sty_123",
"visualGuidelineId": "iqi_01a18cbff6317442800af05496eec95b",
"tools": [
"WEB_SEARCH",
"KNOWLEDGE_SEARCH"
]
}Response
Successfully executed agent task and generated output
Example response
{
"requestId": "bce766ea-a4ef-48e5-9da1-d9602bfecf2d",
"resource": "tasks",
"data": {
"output": [
{
"type": "TEXT",
"value": "This is the generated content from the agent..."
}
],
"metadata": {
"credits": {
"cost": 40
},
"translation": {
"tmsMatches": [
{
"sourceSegment": "Click Save to continue.",
"matches": [
{
"target": "Klicken Sie auf Speichern, um fortzufahren.",
"score": 1
}
]
}
]
}
}
}
}Changes
- breaking
added to the
//response propertyoneOflist for the response status - breaking
the
//response's property type changed fromobjectto no type for status - breaking
removed the required property
///from the response with the status - breaking
removed the required property
///from the response with the status - warning
removed the request property
- info
added the new optional request property
- info
added the new optional request property
- info
added the new optional request property
- info
added the new optional request property
- info
the
request property default valuewas removed
- breaking