Deploys · Reference
API
The API mybeast-deploy calls. Use it to report deploys from a tool of your own: start a deploy, send its log as it comes, then say how it ended.
Basics
| Base URL | https://services.my-beast.com/deploys/api/v1, over HTTPS |
| Authentication | Authorization: Bearer sk_….…, a Deploys server secret. It reaches the key's own project only: another project's deploys are not found. |
| Requests | Form fields (application/x-www-form-urlencoded), as curl's --data-urlencode sends them; a batch of the log is its plain bytes. Send Accept: application/json. |
| Responses | Flat JSON objects. Starting a deploy answers 201 Created, everything else 200 OK. Errors are under Errors. |
| Rate limit | 600 requests a minute per key. mybeast-deploy sends a batch every 2 seconds, so one key reports several deploys at once. |
A deploy is three calls: start it, send its log in batches while it runs, and finish it. Each answer carries the deploy's id, which the next calls name.
Start a deploy
POST/deploys
A deploy or a rollback starts. Only app and environment are needed: the rest is what the machine says about itself. A new app adds the app.
| Field | Type | What it is |
|---|---|---|
apprequired | string | The app's key: lower-case letters, digits and inner dashes, up to 40 characters. A new key adds the app. |
environmentrequired | string | One of the project's environments. A name the project does not have is refused with the list it has. |
kind | string | deploy (the default) or rollback. |
command | string | The command as it is shown, up to 4,000 characters. Secret-looking values are masked again before it is kept. |
commit | string | The checkout's commit: 7 to 40 lower-case hex characters. |
commit_subject | string | The commit's subject line. |
branch | string | The checked-out branch. |
commits | string | The checkout's last commits, newest first, one a line: the 40-character hash, a tab, the author, a tab, the subject. The ones after what is live in the environment are kept, up to 50. Ignored for a rollback. |
dirty | boolean | 1 when the checkout had uncommitted changes. |
actor_name | string | Who ran it, as git's user.name says. |
actor_email | string | Their e-mail address, as git's user.email says. When it is a My Beast person's, the deploy shows their name. |
machine | string | The machine's name. |
os_user | string | The system user who ran it. |
release | string | What this build is called: 1 to 64 letters, digits and . _ + -. |
rollback_to | string | A rollback's target release, the same shape. Without it, a rollback goes to the good deploy before what is live. |
cli_version | string | The version of the tool reporting, up to 20 characters. |
curl https://services.my-beast.com/deploys/api/v1/deploys \
-H "Authorization: Bearer $MYBEAST_DEPLOYS_KEY" \
-H "Accept: application/json" \
--data-urlencode "app=shop" \
--data-urlencode "environment=staging" \
--data-urlencode "command=make deploy:staging" \
--data-urlencode "commit=$(git rev-parse HEAD)" \
--data-urlencode "actor_email=$(git config user.email)"{
"id": "019a3f2e-7b1c-7d4e-9a51-3c2b8e6f0a12",
"number": 12,
"title": "Deploy #12",
"app": "shop",
"environment": "staging",
"kind": "deploy",
"status": "running",
"url": "https://services.my-beast.com/acme/storefront/deploys/apps/shop/deploys/12",
"warning": null
}url is the deploy's page. warning is a sentence for the person when another deploy is still running in the environment, such as Deploy #11 by Anna is still running here (started 3 minutes ago). It never stops this one.
Send the log
POST/deploys/{id}/lines?offset={offset}
The body is the log's bytes from offset on, as text/plain: 0 for the first batch, then the received of the last answer. Send whole lines while the deploy runs; the last line may lack its newline at the end.
- A batch is at most 512 KB.
- A batch sent again after a lost answer is not kept twice: bytes Deploys has already are skipped.
- An empty body says the machine is still there. Without one for 10 minutes, the deploy is marked lost; a batch after that takes it up again.
- Colours and cursor codes are taken out, a line over 2,000 characters is cut, and lines past 50,000 are counted, not kept.
curl "https://services.my-beast.com/deploys/api/v1/deploys/$DEPLOY_ID/lines?offset=0" \
-H "Authorization: Bearer $MYBEAST_DEPLOYS_KEY" \
-H "Accept: application/json" \
-H "Content-Type: text/plain" \
--data-binary @deploy.log{
"received": 18342,
"lines": 214,
"status": "running"
}received is the bytes Deploys has of the log, lines its lines so far. A batch that does not start where the log stands, or one after the deploy ended, is answered 409 with the byte to send from:
{
"message": "The log stands at byte 16384: send from there.",
"expected": 16384
}Finish a deploy
POST/deploys/{id}/finish
How the command ended, as the machine saw it. The first finish stands: another changes nothing, except on a deploy that was marked lost meanwhile.
| Field | Type | What it is |
|---|---|---|
statusrequired | string | succeeded, failed or cancelled (stopped by hand). |
exit_code | integer | The command's exit code, from -1 to 255. |
duration_seconds | integer | How long it took, as the machine timed it: up to 604,800 (a week). The service's own clock otherwise. |
release | string | The build's name, when the machine learnt it while the deploy ran. |
curl https://services.my-beast.com/deploys/api/v1/deploys/$DEPLOY_ID/finish \
-H "Authorization: Bearer $MYBEAST_DEPLOYS_KEY" \
-H "Accept: application/json" \
--data-urlencode "status=succeeded" \
--data-urlencode "exit_code=0" \
--data-urlencode "duration_seconds=92"{
"id": "019a3f2e-7b1c-7d4e-9a51-3c2b8e6f0a12",
"number": 12,
"title": "Deploy #12",
"app": "shop",
"environment": "staging",
"kind": "deploy",
"status": "succeeded",
"url": "https://services.my-beast.com/acme/storefront/deploys/apps/shop/deploys/12",
"release": "20261101-101500-a1b2c3d",
"took": "1m 32s"
}release is the name the deploy ended with, found as The line that names the release says. A deploy that succeeded becomes what is live in its environment and, unless it is a rollback, names its release in Errors when the app has an Errors key. One that failed is told to the project's people.
Read an app
GET/apps/{app}?environment={environment}
An app's saved commands, and what is live in an environment: what mybeast-deploy status prints. environment is optional; with it, the commands have {env} filled in.
curl "https://services.my-beast.com/deploys/api/v1/apps/shop?environment=staging" \
-H "Authorization: Bearer $MYBEAST_DEPLOYS_KEY" \
-H "Accept: application/json"{
"app": "shop",
"name": "Shop",
"environment": "staging",
"deploy_command": "make deploy:staging",
"rollback_command": "make rollback:staging",
"live_release": "20261101-101500-a1b2c3d",
"live_commit": "a1b2c3d4",
"live_title": "Deploy #12",
"live_by": "Anna Virtanen",
"live_at": "1.11. 10:16 (2 hours ago)",
"last_status": "succeeded"
}The live_ fields are null when nothing is live there yet, and last_status is how the last deploy there ended. live_at is written for a person, in the service's time zone.
Statuses
| Status | On the pages | Meaning |
|---|---|---|
running | Running | Still running: the log grows as it comes. |
succeeded | Succeeded | The command ended well (exit code 0). What it shipped is live now. |
failed | Failed | The command ended with an error. Its people are told. |
cancelled | Stopped | Stopped by hand (Ctrl-C) before it ended. Nobody is told. |
lost | Lost | The machine stopped reporting before it said how the deploy ended: after 10 minutes of silence its people are told. Someone may also close a quiet one by hand. |
A machine finishes a deploy with succeeded, failed or cancelled; lost is Deploys' own word.
Errors
An error answers with a message in words a person can act on. mybeast-deploy prints it, and runs the deploy all the same.
| Status | When |
|---|---|
| 401 | {"message": "unauthenticated"}: no key, a revoked one, or a key that is not a Deploys server secret. |
| 402 | The project's subscription has ended: nothing new is taken in. The answer has message, type (subscription_ended) and link, where it is renewed. |
| 404 | No such deploy in the key's project, or (for GET /apps/{app}) no app with that key yet. |
| 409 | A batch of the log does not start where the log stands, or the deploy has ended. expected says the byte to send from. |
| 413 | A batch of the log over 512 KB: send it in parts. |
| 422 | A field is missing or the wrong shape (message and Laravel's errors, by field), or the service refused in words (message): an environment the project does not have, or a new app past the package's limit. |
| 429 | More than 600 requests a minute with one key. Wait as Retry-After says, then send again. |
For example, an environment the project does not have:
{
"message": "Storefront has no environment “prd”: its environments are staging and production. A project admin adds one at https://id.my-beast.com/…, or --env names one of these."
}