Sample - GitHub REST API
POST/repos/{owner}/{repo}/deployments/{deployment_id}/statuses

Create a deployment status

Users with push access can create deployment statuses for a given deployment.

OAuth app tokens and personal access tokens (classic) need the repo_deployment scope to use this endpoint.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

3 parameters · 7 body fields
ownerstringrequired
The account owner of the repository. The name is not case sensitive.
repostringrequired
The name of the repository without the `.git` extension. The name is not case sensitive.
deployment_idintegerrequired
deployment_id parameter
statestringrequired
The state of the status. When you set a transient deployment to `inactive`, the deployment will be shown as `destroyed` in GitHub.
Allowed:errorfailureinactivein_progressqueuedpendingsuccess
target_urlstringoptional
The target URL to associate with this status. This URL should contain output to keep the user updated while the task is running or serve as historical information for what happened in the deployment. > [!NOTE] > It's recommended to use the `log_url` parameter, which replaces `target_url`.
Default:
log_urlstringoptional
The full URL of the deployment's output. This parameter replaces `target_url`. We will continue to accept `target_url` to support legacy uses, but we recommend replacing `target_url` with `log_url`. Setting `log_url` will automatically set `target_url` to the same value. Default: `""`
Default:
descriptionstringoptional
A short description of the status. The maximum description length is 140 characters.
Default:
environmentstringoptional
Name for the target deployment environment, which can be changed when setting a deploy status. For example, `production`, `staging`, or `qa`. If not defined, the environment of the previous status on the deployment will be used, if it exists. Otherwise, the environment of the deployment will be used.
environment_urlstringoptional
Sets the URL for accessing your environment. Default: `""`
Default:
auto_inactivebooleanoptional
Adds a new `inactive` status to all prior non-transient, non-production environment deployments with the same repository and `environment` name as the created status's deployment. An `inactive` status is only added to deployments that had a `success` state. Default: `true`

2 status codes
201Response
urlstringrequired
idintegerrequired
node_idstringrequired
statestringrequired
The state of the status.
Allowed:errorfailureinactivependingsuccessqueuedin_progress
creatorobjectrequired
A GitHub user.
descriptionstringrequired
A short description of the status.
Default:
environmentstringoptional
The environment of the deployment that the status is for.
Default:
target_urlstringrequired
Closing down notice: the URL to associate with this status.
Default:
created_atstringrequired
updated_atstringrequired
deployment_urlstringrequired
repository_urlstringrequired
environment_urlstringoptional
The URL for accessing your environment.
Default:
log_urlstringoptional
The URL to associate with this status.
Default:
performed_via_github_appobjectoptional
GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub.
422Validation failed, or the endpoint has been spammed.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional

Error handling

A 422 is returned: Validation failed, or the endpoint has been spammed.