API documentation
Create an Agent Task
Create and execute tasks using individual AI agents (BLACKBOX or Claude Code or Codex or Gemini)on repositories.
POST
This endpoint allows you to create tasks that AI agents can execute. You can either:Documentation Index
Fetch the complete documentation index at: https://docs.blackbox.ai/llms.txt
Use this file to discover all available pages before exploring further.
- Work on a repository: Provide a
repoUrlto have the agent analyze and modify code in a GitHub repository
Authentication
To use this API, you need a BLACKBOX API Key. Follow these steps to get your API key:- Click on your Profile Image in the top right corner at cloud.blackbox.ai
- Click on “BLACKBOX API Token” from the dropdown menu
- Copy the existing token or click “Generate” if you don’t have one yet
bb_xxxxxxxxxxxxxxxxxxxxxx
GitHub Connection Required
For GitHub-related tasks: Make sure you have connected your GitHub account on https://cloud.blackbox.ai before creating tasks that work with repositories. This is required for the agent to access and modify your repositories.
Headers
API Key of the form
Bearer <api_key>.Example: Bearer bb_b41b647ffbfed27f61656049d3eaeef3d903cc503345d9eb80080d98bc0Must be set to
application/json.Request
The task description or instruction for the AI agent to execute. Be specific about what you want the agent to do.Examples:
- “Create README in French”
- “Add unit tests for authentication module”
- “Refactor the database connection logic”
- “Write a Python script to process CSV files”
GitHub repository URL to work on. If provided, the agent will clone and work on this repository.Example:
https://github.com/<org-name>/<repo-name>.gitThe branch to work on in the repository. Defaults to
main if not specified.Example: main, develop, feature/new-apiThe AI agent to use for executing the task. Each agent has different capabilities and specializations.Available agents:
claude- Anthropic’s Claude models (Sonnet 4.5, Sonnet 4, Opus 4.5)blackbox- BLACKBOX AI models with multiple provider optionscodex- OpenAI’s GPT models (GPT-5.2-Codex, GPT-4.1)gemini- Google’s Gemini models (2.0 Flash, 2.5 Pro)
blackboxThe specific AI model to use with the selected agent. Each agent supports different models.See the Agent Models section below for available options per agent.Default:
blackbox-proAgent Models
Claude Agent
anthropic/claude-sonnet-4.5
BLACKBOX Agent
blackbox-pro
Codex Agent
gpt-5-codex
Gemini Agent
gemini-2.0-flash-exp
Usage Modes
Repository Mode
WhenrepoUrl is provided, the agent will:
- Clone the specified repository
- Checkout the selected branch
- Analyze the codebase
- Execute the task within the repository context
- Create commits with the changes
Error Codes
| Status Code | Error | Description |
|---|---|---|
| 200 | Success | Task created successfully |
| 400 | Bad Request | Invalid request (missing prompt, invalid agent/model, invalid repo URL) |
| 401 | Unauthorized | Invalid or missing API key |
| 402 | Payment Required | Insufficient credits to create task |
| 403 | Forbidden | User is not a member of the selected team |
| 404 | Not Found | GitHub token not found or user not found |
| 500 | Internal Server Error | Task creation failed or database error |
| 502 | Bad Gateway | GitHub API error or file upload failed |