The Codegen API provides programmatic access to create and manage AI agents, enabling you to integrate Codegen’s capabilities into your own applications and workflows.

What You Can Do

Create and manage AI agents that can write code, fix bugs, and handle development tasks across your repositories with full programmatic control over their execution and monitoring. Access your organization data including users, repositories, integrations, and programmatically retrieve detailed agent traces for analysis and debugging.
All agents created through the API are fully configurable and viewable in the Codegen web UI at codegen.com, allowing seamless integration between programmatic and manual workflows.
Not seeing a capability you want? Get in touch! Join our community Slack or email us at support@codegen.com.

Authentication

All API endpoints require authentication using Bearer tokens and your organization ID.

Authentication Guide

Get your API token and organization ID to start using the Codegen API.

Rate Limits

The API includes rate limiting to ensure fair usage:
  • Standard endpoints: 60 requests per 30 seconds
  • Agent creation: 10 requests per minute
  • Setup commands: 5 requests per minute
  • Log analysis: 5 requests per minute

Getting Started

1. Create Your First Agent Run

curl -X POST "https://api.codegen.com/v1/organizations/{org_id}/agent/run" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Add error handling to the user authentication function",
    "repo_id": 123
  }'

2. Check Agent Status

curl "https://api.codegen.com/v1/organizations/{org_id}/agent/run/{agent_run_id}" \
  -H "Authorization: Bearer YOUR_API_KEY"

3. Resume with Follow-up

curl -X POST "https://api.codegen.com/v1/organizations/{org_id}/agent/run/resume" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_run_id": 456,
    "prompt": "Also add unit tests for the error handling"
  }'

Use Cases

Automated Workflows
  • Trigger agents from CI/CD pipelines when builds fail
  • Create agents in response to issue tracking system events
  • Automate code reviews and quality checks
Custom Integrations
  • Build Codegen into your existing development tools
  • Create custom dashboards for agent activity
  • Integrate with internal systems and workflows
Batch Operations
  • Process multiple repositories with consistent changes
  • Generate setup commands for new projects
  • Analyze logs across multiple sandbox environments

Explore the API

Browse API Endpoints

Explore all available endpoints with detailed schemas and examples.

Programmatically Retrieve Agent Traces

Learn how to retrieve and analyze detailed agent execution logs.

SDKs and Tools

For easier integration, we recommend using our Python SDK which provides a simple wrapper around the API:

Python SDK

Use the Codegen Python SDK for a pythonic interface to create and manage agents programmatically.
Also available:
  • CLI Tool - Command-line interface for common API operations
The API is RESTful and returns JSON responses. All endpoints support standard HTTP status codes and include detailed error messages for troubleshooting.