curl --request POST \
--url https://api.cursor.com/v0/agents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": {
"text": "Add a README.md file with installation instructions",
"images": [
{
"data": "iVBORw0KGgoAAAANSUhEUgAA...",
"dimension": {
"width": 1024,
"height": 768
}
}
]
},
"source": {
"repository": "https://github.com/your-org/your-repo",
"ref": "main"
},
"model": "claude-4-sonnet",
"target": {
"autoCreatePr": false,
"branchName": "feature/add-readme"
},
"webhook": {
"url": "https://example.com/webhooks/cursor-agent",
"secret": "your-webhook-secret-key-minimum-32-characters"
}
}
'{
"id": "bc_abc123",
"name": "Add README Documentation",
"status": "CREATING",
"source": {
"repository": "https://github.com/your-org/your-repo",
"ref": "main"
},
"target": {
"url": "https://cursor.com/agents?id=bc_abc123",
"branchName": "cursor/add-readme-1234",
"autoCreatePr": false
},
"createdAt": "2024-01-15T10:30:00Z"
}Inicia un nuevo agente en segundo plano para trabajar en tu repositorio.
curl --request POST \
--url https://api.cursor.com/v0/agents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": {
"text": "Add a README.md file with installation instructions",
"images": [
{
"data": "iVBORw0KGgoAAAANSUhEUgAA...",
"dimension": {
"width": 1024,
"height": 768
}
}
]
},
"source": {
"repository": "https://github.com/your-org/your-repo",
"ref": "main"
},
"model": "claude-4-sonnet",
"target": {
"autoCreatePr": false,
"branchName": "feature/add-readme"
},
"webhook": {
"url": "https://example.com/webhooks/cursor-agent",
"secret": "your-webhook-secret-key-minimum-32-characters"
}
}
'{
"id": "bc_abc123",
"name": "Add README Documentation",
"status": "CREATING",
"source": {
"repository": "https://github.com/your-org/your-repo",
"ref": "main"
},
"target": {
"url": "https://cursor.com/agents?id=bc_abc123",
"branchName": "cursor/add-readme-1234",
"autoCreatePr": false
},
"createdAt": "2024-01-15T10:30:00Z"
}API key from Cursor Dashboard
Mostrar atributos secundarios
The task or instructions for the agent to execute
1"Add a README.md file with installation instructions"
Optional array of base64 encoded images (max 5)
5Mostrar atributos secundarios
Base64 encoded image data
1"iVBORw0KGgoAAAANSUhEUgAA..."
[
{
"data": "iVBORw0KGgoAAAANSUhEUgAA...",
"dimension": { "width": 1024, "height": 768 }
}
]The LLM to use
1"claude-4-sonnet"
Mostrar atributos secundarios
URL to receive webhook notifications about agent status changes
2048"https://example.com/webhooks/cursor-agent"
Secret key for webhook payload verification
32 - 256"your-webhook-secret-key-minimum-32-characters"
Agent created successfully
Unique identifier for the background agent
"bc_abc123"
Name for the agent
"Add README Documentation"
Initial status of the newly created agent
CREATING "CREATING"
Mostrar atributos secundarios
URL to view the agent in Cursor Web
"https://cursor.com/agents?id=bc_abc123"
The Git branch name where the agent is working
"cursor/add-readme-1234"
Whether a pull request will be automatically created
false
When the agent was created
"2024-01-15T10:30:00Z"
¿Esta página le ayudó?