Docs
Developers

Create tasks via webhook

Every automation has a webhook URL. A POST to it creates a board task, and optionally starts it, using the repository, branch, harness, owner and run mode configured on the automation. This page is the full contract for callers.

Note

The request body only carries what to do: a description and optional files. Where and how — repo, branch, harness, machine, owner, on-receive behaviour and run mode — always come from the automation's settings and can't be overridden per request.

Endpoint

http
POST /webhooks/automations/{webhook_token}
Content-Type: multipart/form-data

Copy the full URL from the automation's Webhook panel (Endpoint → Copy URL) rather than building it yourself. The token in the path identifies the automation, so keep the URL private.

Headers

HeaderRequiredDescription
Content-TypeYesMust be multipart/form-data. Anything else is rejected with 415.
X-Webhook-SecretWhen enabledThe automation's webhook secret. Required whenever Webhook secret is on, otherwise 401.
Idempotency-KeyNoA unique string per event. Retries with the same key return the original task instead of creating a new one.

Form fields

FieldTypeDescription
descriptiontext, requiredWhat the agent should do. Becomes the task's intent and title. Send it once — repeating the field is rejected.
(any name)file, optionalUp to 5 file parts, 5 MB each. Any part with a filename is treated as a file. file is a good field name, repeated for more files.

No other text fields are accepted: an unexpected field is rejected with 400.

If the automation has Instructions, they are prepended to description to form the task's intent.

Accepted file types

png, jpeg, webp, txt, md, csv, tsv, json, yaml and log. The content is checked against the declared type. A file that's the wrong type or doesn't match its content rejects the whole delivery, and no task is created.

Idempotency and retries

Webhook senders often retry. CodeBeast deduplicates deliveries per automation:

  • With Idempotency-Key — a repeat of the same key returns 200 with outcome: "deduped" and the original taskId.
  • Without it — CodeBeast hashes description together with each file's name, type and bytes. An identical retry is still caught, even if the multipart boundary changes.

Only deliveries that created a task are deduplicated. A request that was rejected or rate-limited can be retried with the same key.

Tip

Use your source system's event ID — an alert ID, a form submission ID — as the Idempotency-Key. Two distinct events with the same text then still create two tasks.

Responses

Every response is JSON with ok and outcome. Successful deliveries include the task.

json
{
  "ok": true,
  "outcome": "task_started",
  "deliveryId": "d1f3…",
  "taskId": "8b2c…",
  "taskUrl": "https://app.codebeast.ai/o/…/board/…"
}

Errors include an error message:

json
{
  "ok": false,
  "outcome": "rejected",
  "error": "invalid webhook secret"
}

deliveryId matches the Delivery ID in the automation's Activity log.

Outcomes and status codes

outcomeHTTPMeaning
task_started200Task created and started (On receive: Create and start task).
task_created200Task created in ToDo (On receive: Create task in ToDo). Also returned if the task was created but a file couldn't be attached or the start failed — see error.
deduped200Same idempotency key or body as an earlier successful delivery. The original taskId is returned.
rate_limited429Over the per-automation request limit or the automation's own Rate limit. See Limits.
credit_limited402The automation's daily Credit limit is reached. No task is created.
task_created402The task was created but couldn't start because the organisation is out of credits or the automation's credit limit was hit. It waits in ToDo — see error.
rejected400 401 403 404 413 415The request was refused. See the table below.
failed500Server error while creating or starting the task. Safe to retry with the same Idempotency-Key.

Rejections

HTTPerrorFix
400description is requiredSend a non-empty description field.
400description must be a single fieldSend description once.
400unexpected field: <name>Remove extra text fields. Only description and file parts are allowed.
400too many files (max 5)Send 5 files or fewer.
400empty file: <name>Don't send zero-byte files.
400unsupported file type for <name>Use an accepted file type.
400attachment failed: file content does not match type <mime>Send the correct type= for the file.
400invalid multipart body / multipart boundary missingSend a well-formed multipart/form-data body. Let your HTTP client build it.
400automation repository is no longer connectedAn admin needs to reconnect the repository or update the automation.
401invalid webhook secretSend the current secret in X-Webhook-Secret. It changes when someone clicks Regenerate.
403automation is pausedAn admin needs to click Activate on the automation.
404automation not foundThe URL is wrong, or the automation was deleted.
413file too large: <name>Keep each file at or under 5 MB.
415Content-Type must be multipart/form-dataSend form data, not JSON.

Limits

Limits
  • 20 requests per minute per automation, counting every outcome. Over that you get 429 with Retry-After: 60 and "Too many requests. Try again in a minute."
  • The automation's own Rate limit, if set — a maximum number of tasks per hour, day or week. Over it you get 429 with "This automation's delivery limit was reached. Try again later."
  • The automation's daily Credit limit, if set, resets at 00:00 UTC.
  • Up to 5 files, 5 MB each.
  • Normal organisation limits still apply: credits, and up to 5 running tasks per organisation.

Examples

Description only:

bash
curl -X POST "$WEBHOOK_URL" \
  -H "X-Webhook-Secret: $WEBHOOK_SECRET" \
  -H "Idempotency-Key: alert-48213" \
  -F "description=Checkout returns 500 when the cart has a discount code. Find the cause and open a pull request with a fix."

With a screenshot and a log file:

bash
curl -X POST "$WEBHOOK_URL" \
  -H "X-Webhook-Secret: $WEBHOOK_SECRET" \
  -H "Idempotency-Key: ticket-9917" \
  -F "description=Review the attached screenshot and log, and open a pull request that fixes the broken layout." \
  -F "file=@layout.png;type=image/png" \
  -F "file=@console.log;type=text/plain"

From Node.js:

js
const form = new FormData();
form.append("description", "Bump the minimum Node version to 22 and fix any type errors.");
form.append("file", new Blob([logText], { type: "text/plain" }), "ci.log");

const res = await fetch(process.env.WEBHOOK_URL, {
  method: "POST",
  headers: {
    "X-Webhook-Secret": process.env.WEBHOOK_SECRET,
    "Idempotency-Key": event.id,
  },
  body: form, // fetch sets the multipart Content-Type and boundary
});
const out = await res.json();
if (!out.ok) throw new Error(`${res.status} ${out.outcome}: ${out.error}`);
console.log("Task:", out.taskUrl);
Tip

To check your setup without creating a task, use Test webhook → Dry run on the automation's page. See Automations.

Troubleshooting

SymptomLikely cause
415 from a JSON clientThe webhook only accepts multipart/form-data. Send description as a form field.
Every call returns dedupedYou're reusing the same Idempotency-Key, or sending identical bodies without one. Use a unique key per event.
task_created when you expected task_startedOn receive is set to Create task in ToDo, or the start was refused (out of credits, or the running-task limit was reached). Check error.
401 after it used to workSomeone regenerated the secret. Copy the new one from the Webhook panel.
Task created but it's waiting on youThe automation's Run mode is Normal, so it pauses for clarifying questions and PRD approval. Switch to Auto to skip them.