Agents
List all agent conversations for the authenticated user.
API key passed in the Authorization header. Format: <api-key>
Filter conversations by title.
Filter conversations by feature type.
Comma-separated list of relationships to include. Available: messages.
Sort results. Prefix with - for descending. Available: id, title, created_at.
Successful response
Unauthenticated
Unauthorized
GET /api/v1/agents/conversations HTTP/1.1
Host: core.wearepatchworks.com
Authorization: YOUR_API_KEY
Accept: */*
{
"data": [
{
"id": "01hvh37yjs9kt7dd1t27azryvb",
"feature_type": "script_editor",
"title": "Generate order sync script",
"payload": {
"context": "order"
},
"created_at": "2024-01-01T00:00:00.000000Z",
"updated_at": "2024-01-01T00:00:00.000000Z"
}
]
}Start a new agent conversation. The agent will process the initial prompt asynchronously — poll the conversation for updated messages.
API key passed in the Authorization header. Format: <api-key>
The feature type to use for the conversation (e.g. script_editor).
The initial prompt message.
Optional context payload passed to the agent.
Conversation started
Unauthenticated
Unauthorized
Validation Error
POST /api/v1/agents/conversations HTTP/1.1
Host: core.wearepatchworks.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 126
{
"feature": "script_editor",
"prompt": "Generate a script to sync orders from Shopify to our ERP.",
"payload": {
"context": "order"
}
}{
"data": {
"id": "01hvh37yjs9kt7dd1t27azryvb",
"feature_type": "script_editor",
"title": "Generate order sync script",
"payload": {
"context": "order"
},
"created_at": "2024-01-01T00:00:00.000000Z",
"updated_at": "2024-01-01T00:00:00.000000Z"
}
}Get a single agent conversation by ID.
API key passed in the Authorization header. Format: <api-key>
The unique identifier of the conversation.
Comma-separated list of relationships to include. Available: messages.
Successful response
Unauthenticated
Unauthorized
Conversation not found
GET /api/v1/agents/conversations/{conversation} HTTP/1.1
Host: core.wearepatchworks.com
Authorization: YOUR_API_KEY
Accept: */*
{
"data": {
"id": "01hvh37yjs9kt7dd1t27azryvb",
"feature_type": "script_editor",
"title": "Generate order sync script",
"payload": {
"context": "order"
},
"created_at": "2024-01-01T00:00:00.000000Z",
"updated_at": "2024-01-01T00:00:00.000000Z"
}
}Send a follow-up message to an existing agent conversation. The agent processes the reply asynchronously — poll the conversation for updated messages.
API key passed in the Authorization header. Format: <api-key>
The unique identifier of the conversation.
The reply message.
Reply accepted and queued for processing
No content
Unauthenticated
Unauthorized
Conversation not found
Validation Error
POST /api/v1/agents/conversations/{conversation}/reply HTTP/1.1
Host: core.wearepatchworks.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 52
{
"message": "Can you also handle partial shipments?"
}No content
Get the current month's agent token usage and allowance for your organisation.
API key passed in the Authorization header. Format: <api-key>
Successful response
Unauthenticated
Unauthorized
GET /api/v1/agents/usage HTTP/1.1
Host: core.wearepatchworks.com
Authorization: YOUR_API_KEY
Accept: */*
{
"data": {
"tokens_used": 125000,
"token_allowance": 500000
}
}Last updated
Was this helpful?