Scale AI Task Retention API
The task-retention API from Scale AI — 3 operation(s) for task-retention.
The task-retention API from Scale AI — 3 operation(s) for task-retention.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/scale-ai:scale-ai-task-retention-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Agentex Task Retention API
version: 0.1.0
tags:
- name: task-retention
paths:
/tasks/{task_id}/export:
get:
tags:
- task-retention
summary: Export Task
description: 'Build a self-contained snapshot of a task''s content surfaces.
Returns the exact payload format that POST /rehydrate accepts, so
export → clean → rehydrate is a round-trip-equivalent operation.'
operationId: export_task_tasks__task_id__export_get
parameters:
- name: task_id
in: path
required: true
schema:
type: string
title: Task Id
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/ExportTaskResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
post:
tags:
- task-retention
summary: Export Task To Url
description: 'Build the task snapshot and PUT it to a caller-supplied presigned URL.
Use this when the snapshot is too large for a JSON response body (long
conversations, deep reasoning content, many attachments). The upload URL
must be https and resolve to a public address — see SSRF guard.'
operationId: export_task_to_url_tasks__task_id__export_post
parameters:
- name: task_id
in: path
required: true
schema:
type: string
title: Task Id
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ExportTaskToUrlRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/ExportTaskToUrlResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/tasks/{task_id}/clean:
post:
tags:
- task-retention
summary: Clean Task
description: 'Delete content-bearing rows for a stale task.
Refuses on active tasks, in-flight workflows, or unprocessed events
regardless of `force`. The `force=true` flag only bypasses the
idle-threshold check.'
operationId: clean_task_tasks__task_id__clean_post
parameters:
- name: task_id
in: path
required: true
schema:
type: string
title: Task Id
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CleanTaskRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/CleanTaskResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/tasks/{task_id}/rehydrate:
post:
tags:
- task-retention
summary: Rehydrate Task
description: 'Restore content-bearing rows from a snapshot.
Two modes:
- Inline: caller provides messages and task_states in the request body.
- URL: caller provides snapshot_url; Agentex downloads and parses it.
Refuses if the task isn''t currently in a cleaned state, or if any supplied
message/state ID already exists in Mongo (catches double-rehydrate).'
operationId: rehydrate_task_tasks__task_id__rehydrate_post
parameters:
- name: task_id
in: path
required: true
schema:
type: string
title: Task Id
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RehydrateTaskRequest'
responses:
'204':
description: Successful Response
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
components:
schemas:
RehydrateTaskRequest:
properties:
task_id:
type: string
title: Task Id
messages:
items:
$ref: '#/components/schemas/TaskMessageEntity'
type: array
title: Messages
task_states:
items:
$ref: '#/components/schemas/StateEntity'
type: array
title: Task States
snapshot_url:
anyOf:
- type: string
maxLength: 2083
minLength: 1
format: uri
- type: 'null'
title: Snapshot Url
description: Presigned GET URL whose body is a JSON-encoded TaskSnapshotEntity. Must be https; must resolve to a public address. When set, messages/task_states must be empty.
type: object
required:
- task_id
title: RehydrateTaskRequest
description: 'Either provide inline content (messages + task_states) or a snapshot_url
pointing at a presigned JSON download. Mixing both is rejected.
The inline form is the canonical shape used by export''s GET response, so
snapshot → clean → rehydrate round-trips cleanly without serialization
changes.'
ToolResponseContentEntity:
properties:
type:
type: string
const: tool_response
title: Type
description: The type of the message, in this case `tool_response`.
default: tool_response
author:
$ref: '#/components/schemas/MessageAuthor'
description: The role of the messages author, in this case `system`, `user`, `assistant`, or `tool`.
style:
$ref: '#/components/schemas/MessageStyle'
description: The style of the message. This is used by the client to determine how to display the message.
default: static
tool_call_id:
type: string
title: Tool Call Id
description: The ID of the tool call that is being responded to.
name:
type: string
title: Name
description: The name of the tool that is being responded to.
content:
title: Content
description: The result of the tool.
is_error:
anyOf:
- type: boolean
- type: 'null'
title: Is Error
description: Whether the tool call resulted in an error. `None` when the harness does not report a status.
type: object
required:
- author
- tool_call_id
- name
- content
title: ToolResponseContentEntity
TaskMessageEntity:
properties:
id:
anyOf:
- type: string
- type: 'null'
title: Id
description: The task message's unique id
task_id:
type: string
title: Task Id
description: ID of the task this message belongs to
content:
oneOf:
- $ref: '#/components/schemas/TextContentEntity'
- $ref: '#/components/schemas/DataContentEntity'
- $ref: '#/components/schemas/ToolRequestContentEntity'
- $ref: '#/components/schemas/ToolResponseContentEntity'
- $ref: '#/components/schemas/ReasoningContentEntity'
title: Content
description: The content of the message. This content is not OpenAI compatible. These are messages that are meant to be displayed to the user.
discriminator:
propertyName: type
mapping:
data: '#/components/schemas/DataContentEntity'
reasoning: '#/components/schemas/ReasoningContentEntity'
text: '#/components/schemas/TextContentEntity'
tool_request: '#/components/schemas/ToolRequestContentEntity'
tool_response: '#/components/schemas/ToolResponseContentEntity'
streaming_status:
anyOf:
- type: string
enum:
- IN_PROGRESS
- DONE
- type: 'null'
title: In case of streaming, this indicates whether the message is still being streamed or has been completed
created_at:
anyOf:
- type: string
format: date-time
- type: 'null'
title: Created At
description: The timestamp when the message was created
updated_at:
anyOf:
- type: string
format: date-time
- type: 'null'
title: Updated At
description: The timestamp when the message was last updated
type: object
required:
- task_id
- content
title: TaskMessageEntity
description: 'Represents a message in the agent system.
This entity is used to store messages in MongoDB, with each message
associated with a specific task.'
TextContentEntity:
properties:
type:
type: string
const: text
title: Type
description: The type of the message, in this case `text`.
default: text
author:
$ref: '#/components/schemas/MessageAuthor'
description: The role of the messages author, in this case `system`, `user`, `assistant`, or `tool`.
style:
$ref: '#/components/schemas/MessageStyle'
description: The style of the message. This is used by the client to determine how to display the message.
default: static
format:
$ref: '#/components/schemas/TextFormat'
description: The format of the message. This is used by the client to determine how to display the message.
default: plain
content:
type: string
title: Content
description: The contents of the text message.
attachments:
anyOf:
- items:
$ref: '#/components/schemas/FileAttachmentEntity'
type: array
- type: 'null'
title: Attachments
description: Optional list of file attachments with structured metadata.
type: object
required:
- author
- content
title: TextContentEntity
StateEntity:
properties:
id:
anyOf:
- type: string
- type: 'null'
title: Id
description: The task state's unique id
task_id:
type: string
title: Task Id
description: ID of the task this state belongs to. The combination of task_id and agent_id is globally unique.
agent_id:
type: string
title: Agent Id
description: ID of the agent this state belongs to. The combination of task_id and agent_id is globally unique.
state:
additionalProperties: true
type: object
title: State
description: The state object that contains arbitrary data
created_at:
anyOf:
- type: string
format: date-time
- type: 'null'
title: Created At
description: The timestamp when the state was created
updated_at:
anyOf:
- type: string
format: date-time
- type: 'null'
title: Updated At
description: The timestamp when the state was last updated
type: object
required:
- task_id
- agent_id
- state
title: StateEntity
description: 'Represents a state in the agent system. A state is associated uniquely with a task and an agent.
This entity is used to store states in MongoDB, with each state
associated with a specific task and agent. The combination of task_id and agent_id is globally unique.
The state is a dictionary of arbitrary data.'
ExportTaskResponse:
properties:
task_id:
type: string
title: Task Id
messages:
items:
$ref: '#/components/schemas/TaskMessageEntity'
type: array
title: Messages
task_states:
items:
$ref: '#/components/schemas/StateEntity'
type: array
title: Task States
type: object
required:
- task_id
title: ExportTaskResponse
description: Wire format mirrors the entity directly — schema parity is intentional.
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
ReasoningContentEntity:
properties:
type:
type: string
const: reasoning
title: Type
description: The type of the message, in this case `reasoning`.
default: reasoning
author:
$ref: '#/components/schemas/MessageAuthor'
description: The role of the messages author, in this case `system`, `user`, `assistant`, or `tool`.
style:
$ref: '#/components/schemas/MessageStyle'
description: The style of the message. This is used by the client to determine how to display the message.
default: static
summary:
items:
type: string
type: array
title: Summary
description: A list of short reasoning summaries
content:
anyOf:
- items:
type: string
type: array
- type: 'null'
title: Content
description: The reasoning content or chain-of-thought text
type: object
required:
- author
- summary
title: ReasoningContentEntity
DataContentEntity:
properties:
type:
type: string
const: data
title: Type
description: The type of the message, in this case `data`.
default: data
author:
$ref: '#/components/schemas/MessageAuthor'
description: The role of the messages author, in this case `system`, `user`, `assistant`, or `tool`.
style:
$ref: '#/components/schemas/MessageStyle'
description: The style of the message. This is used by the client to determine how to display the message.
default: static
data:
additionalProperties: true
type: object
title: Data
description: The contents of the data message.
type: object
required:
- author
- data
title: DataContentEntity
ExportTaskToUrlResponse:
properties:
task_id:
type: string
title: Task Id
upload_url:
type: string
title: Upload Url
uploaded_bytes:
type: integer
title: Uploaded Bytes
messages_count:
type: integer
title: Messages Count
task_states_count:
type: integer
title: Task States Count
type: object
required:
- task_id
- upload_url
- uploaded_bytes
- messages_count
- task_states_count
title: ExportTaskToUrlResponse
CleanTaskResponse:
properties:
task_id:
type: string
title: Task Id
cleaned_at:
type: string
format: date-time
title: Cleaned At
messages_deleted:
type: integer
title: Messages Deleted
task_states_deleted:
type: integer
title: Task States Deleted
events_deleted:
type: integer
title: Events Deleted
type: object
required:
- task_id
- cleaned_at
- messages_deleted
- task_states_deleted
- events_deleted
title: CleanTaskResponse
FileAttachmentEntity:
properties:
file_id:
type: string
title: File Id
description: The unique ID of the attached file
name:
type: string
title: Name
description: The name of the file
size:
type: integer
title: Size
description: The size of the file in bytes
type:
type: string
title: Type
description: The MIME type or content type of the file
type: object
required:
- file_id
- name
- size
- type
title: FileAttachmentEntity
description: Represents a file attachment in messages.
ExportTaskToUrlRequest:
properties:
upload_url:
type: string
maxLength: 2083
minLength: 1
format: uri
title: Upload Url
description: Presigned PUT URL where Agentex will upload the task snapshot as JSON. Must be https; must resolve to a public address.
type: object
required:
- upload_url
title: ExportTaskToUrlRequest
MessageStyle:
type: string
enum:
- static
- active
title: MessageStyle
TextFormat:
type: string
enum:
- markdown
- plain
- code
title: TextFormat
ToolRequestContentEntity:
properties:
type:
type: string
const: tool_request
title: Type
description: The type of the message, in this case `tool_request`.
default: tool_request
author:
$ref: '#/components/schemas/MessageAuthor'
description: The role of the messages author, in this case `system`, `user`, `assistant`, or `tool`.
style:
$ref: '#/components/schemas/MessageStyle'
description: The style of the message. This is used by the client to determine how to display the message.
default: static
tool_call_id:
type: string
title: Tool Call Id
description: The ID of the tool call that is being requested.
name:
type: string
title: Name
description: The name of the tool that is being requested.
arguments:
additionalProperties: true
type: object
title: Arguments
description: The arguments to the tool.
type: object
required:
- author
- tool_call_id
- name
- arguments
title: ToolRequestContentEntity
ValidationError:
properties:
loc:
items:
anyOf:
- type: string
- type: integer
type: array
title: Location
msg:
type: string
title: Message
type:
type: string
title: Error Type
input:
title: Input
ctx:
type: object
title: Context
type: object
required:
- loc
- msg
- type
title: ValidationError
CleanTaskRequest:
properties:
force:
type: boolean
title: Force
description: Skip the idle-threshold check. Active-workflow and unprocessed-events checks still apply. Admin use only.
default: false
idle_days:
type: integer
minimum: 1.0
title: Idle Days
description: Idle threshold in days (ignored when force=true).
default: 7
type: object
title: CleanTaskRequest
MessageAuthor:
type: string
enum:
- user
- agent
title: MessageAuthor