---
title: "POST /projects/{project_id}/agents"
method: POST
path: "/projects/{project_id}/agents"
tags: ["Agents"]
---

# POST /projects/{project_id}/agents

`POST /projects/{project_id}/agents`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/projects/{project_id}/agents`
- Auth: HTTP bearer

## Path parameters

- `project_id` integer, required

## Request body

- UpsertAgentRequest
  - `ai_model` string, nullable: Preferred model identifier for the CLI. `Some("")` clears the stored value.
  - `ai_provider` string, nullable
  - `ai_provider_key_id` integer, nullable
  - `api_key` string, nullable: Plain-text API key — will be encrypted before storage
  - `branch_prefix` string, nullable
  - `config_repo_branch` string, nullable: Branch of the config repo to use (default: "main").
  - `config_repo_url` string, nullable: Private config repo containing .claude/ directory (skills, MCP, plugins).
  - `cooldown_minutes` integer, nullable
  - `daily_budget_cents` integer, nullable
  - `deliverable` string, nullable
  - `description` string, nullable
  - `enabled` boolean, nullable
  - `max_turns` integer, nullable
  - `mcp_servers_config` unknown
  - `name` string, nullable
  - `prompt` string, nullable
  - `sandbox_enabled` boolean, nullable
  - `skills_config` unknown
  - `slug` string, nullable
  - `timeout_seconds` integer, nullable
  - `tools_config` unknown
  - `trigger_config` unknown

## Response `201`

Agent created

- AgentConfigResponse: Response DTO for a single agent — masks the encrypted API key.
  - `ai_model` string, nullable: Preferred model for the CLI (e.g. "sonnet", "gpt-6.2-sol"). `None` means default.
  - `ai_provider` string, required
  - `ai_provider_key_id` integer, nullable
  - `api_key_set` boolean, required: `true` if an API key is set; `false` otherwise.
  - `branch_prefix` string, required
  - `config_repo_branch` string, nullable: Branch of the config repo to use.
  - `config_repo_url` string, nullable: Private config repo containing .claude/ directory (skills, MCP, plugins).
  - `cooldown_minutes` integer, required
  - `created_at` string, required
  - `daily_budget_cents` integer, required
  - `deliverable` string, required
  - `description` string, nullable
  - `enabled` boolean, required
  - `id` integer, required
  - `max_turns` integer, required
  - `mcp_servers_config` unknown
  - `name` string, required
  - `project_id` integer, required
  - `prompt` string, nullable
  - `sandbox_enabled` boolean, nullable: None = use global sandbox setting, true = force on, false = force off
  - `skills_config` unknown
  - `slug` string, required
  - `source` string, required
  - `timeout_seconds` integer, required
  - `tools_config` unknown
  - `trigger_config` unknown, required
  - `updated_at` string, required
  - `webhook_token` string, nullable: Secret token for the `X-Webhook-Token` header. Returned in full exactly once, by the request that mints it (creating an agent with the webhook trigger on, or turning that trigger on). Every later read is `***`: the row holds only a digest, so the token cannot be shown again. Turn the webhook trigger off and on to mint a replacement.
  - `webhook_url` string, nullable: Public webhook URL for triggering this agent externally. Only set when `on: { webhook: true }` is configured. Usage: `POST {webhook_url}` with header `X-Webhook-Token: {webhook_token}`

## Other responses

- `400`: Validation error
- `401`: Unauthorized
- `403`: Insufficient permissions
- `500`: Internal server error

## Changes

- **2026-04-25** `774be20905f2`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/projects/:project_id/agents/post.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
