Skip to content

Deployments

LinearB customers can customize their deploy-time measurement to detect code deployments via an API call. This can also be customized to account for additional pre-deploy stages such as staging, pre-production, or QA. Additional stages added will be broken out in Metrics reports in LinearB.

Attention

Please note that the 'stage' field is a premium feature only available to our paying customers. To access this field and other exclusive benefits, consider upgrading to one of our premium plans. Visit our Pricing Page for more information

Create deployment

Report your deployment to LinearB to track your deployment activity

HTTP request

POST  https://public-api.linearb.io/api/v1/deployments

Body parameters

Parameter name Value Description
repo_url
(required)
string The git repository url
Pattern: ^https://[a-zA-Z0-9./+^@_-]{15,250}$
should have .git suffix for qualified urls
ref_name
(required)
string Ref name of the release, accepts any Git ref (i.e. commit short or long sha/tag name)
Pattern:^[!\"#\$%&\'()+,-0-9;<=>\@A-Z]_`a-z{
timestamp string
(timestamp ISO 8601 format)
The deployment or custom pre-deployment stage occurred at this specific time
stage string
(lowercase only)
The key of the custom pre-deployment stage
services Array of strings
(lowercase only)
The list of LinearB services names monitoring this

Examples

Report release using tag

{
  "repo_url": "https://github.com/owner/my-repo.git",
  "ref_name": "v1.20.55"
}

Report release using commit SHA

{
  "repo_url": "https://github.com/owner/my-repo.git",
  "ref_name": "cf8386c6c92bb24b3e7a48a62cef758d6dbed0ca"
}

Report custom stage

{
  "repo_url": "https://github.com/owner/my-repo.git",
  "ref_name": "cf8386c6c92bb24b3e7a48a62cef758d6dbed0ca",
  "timestamp": "2022-03-14T22:23:34Z",
  "stage": "my_stage"
}

Report custom service

{
  "repo_url": "https://github.com/owner/my-repo.git",
  "ref_name": "cf8386c6c92bb24b3e7a48a62cef758d6dbed0ca",
  "timestamp": "2022-03-14T22:23:34Z",
  "stage": "my_stage",
  "services": [
    "service a",
    "service b"
  ]
}

Responses

200 - Successful Response

{
  "request_id": "string"
}

400 - Bad Request

401 - Unauthorized

405 - Method Not Allowed

422 - Validation Error

{
  "detail": [
    {
      "loc": [
        "string",
        0
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

500 - Internal Server Error

List deployments

Get a list of deployments that have been saved in the LinearB platform

HTTP request

GET  https://public-api.linearb.io/api/v1/deployments

Query parameters

Parameter name Value Description
repository_id integer The git repository id
before string
(timestamp ISO 8601 format)
Return deployments or custom pre-deployment stages that occurred before this specific time
after string
(timestamp ISO 8601 format)
Return deployments or custom pre-deployment stages that occurred after this specific time
limit integer The maximum number of deployments to return. Acceptable values are 1 to 100, inclusive.
(Default: 10)
stage string
(lowercase only)
The key of the custom pre-deployment stage
sort_by string Sort by
Valid values are: "published_at"
(Default: "published_at")
sort_dir string Sort direction
Valid values are: "desc" and "asc"
(Default: "desc")
commit_sha string Git commit short or long sha
offset string Access next page of results

Responses

200 - Successful Response

{
  "total": 0,
  "items": [
    {}
  ]
}

400 - Bad Request

401 - Unauthorized

405 - Method Not Allowed

422 - Validation Error

{
  "detail": [
    {
      "loc": [
        "string",
        0
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

500 - Internal Server Error