# Create a deployment status

> Add a status to a reported deployment: state (queued, in_progress, success, failure, error or inactive), description, environment_url (where it is served) and log_url (where its output can be read).

<div class="g1t-endpoint"><span class="g1t-method" data-method="post">POST</span><code>/repos/{owner}/{name}/deployments/{id}/statuses</code></div>

The deployment takes its state, and any address it gives. A success with auto_inactive (true unless you say) makes the environment's older successful deployments inactive. The commit's `deploy / &lt;environment>` check follows: pending while queued or in progress, then success, failure or error. A g1t.page build's statuses come from the build and cannot be added to. Needs the Write role.

`queued` and `in_progress` set the commit's `deploy / &lt;environment>` check pending; `success`, `failure` and `error` settle it; `inactive` leaves it. A success makes the environment's older successful deployments `inactive` unless `auto_inactive` is false. A g1t.page build (`dpl_…`) answers `409`: its statuses come from the build.

- **Authentication:** Required. Send an [access token](/reference/api/#authentication) as `Authorization: Bearer`.
- **MCP tool:** [`workflow`](/reference/mcp/#workflow) with `action` `create_deployment_status`, and the same inputs
- **Scope:** An access token needs [`deployments:write`](/guides/authentication/#scopes).

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `owner` | string | Yes | The workspace that owns the repository. |
| `name` | string | Yes | The repository's name. |
| `id` | string | Yes | The deployment's id: dep_… for a reported one, dpl_… for a g1t.page build. |

## Body parameters

Send a JSON object. Names are `snake_case`, as in responses; the `camelCase` spelling is accepted too.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `state` | string | Yes | Where it is now. One of `queued`, `in_progress`, `success`, `failure`, `error`, `inactive`. |
| `description` | string | No | A short note, at most 1,000 characters. |
| `environment_url` | string | No | Where it is served, an http(s) address. |
| `log_url` | string | No | Where its output can be read, an http(s) address. |
| `auto_inactive` | boolean | No | On a success, make the environment's older successful deployments inactive. True unless you say. |

## Example request

```sh
curl -X POST https://api.g1t.sh/repos/flagon-io/g1t/deployments/dep_01kq7z9a1c3e5g7j9m1p3r5t7v/statuses \
  -H "Authorization: Bearer $G1T_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "state": "failure",
    "description": "Smoke tests failed",
    "log_url": "https://ci.example.com/pipelines/4182"
  }'
```

## Example response

A successful request answers `200` with:

```json
{
  "id": "dst_01kq7zc2e4g6j8m0p2r4t6v8x0",
  "deployment_id": "dep_01kq7z9a1c3e5g7j9m1p3r5t7v",
  "state": "failure",
  "description": "Smoke tests failed",
  "environment_url": null,
  "log_url": "https://ci.example.com/pipelines/4182",
  "creator": "flagon-io",
  "created_at": "2026-10-06T21:44:58.020Z"
}
```

## Errors

A failed request answers with one of these statuses and a body like `{"error": {"code": "not_found", "message": "Repository not found."}}`. See [errors](/reference/api/#errors).

| Status | Code | When |
| --- | --- | --- |
| 401 | `unauthenticated` | A token is required, or the one sent is not valid. |
| 403 | `forbidden` | The token is valid but not allowed to do this, such as a member-only change or an agent token outside its repository. |
| 404 | `not_found` | It does not exist, or you cannot see it. |
| 409 | `conflict` | The request conflicts with the current state. |
| 422 | `invalid` | The input is not valid. `message` says which field and why. |
