The HTTP API behind the djangocloud command line tool. Most people only need the CLI; the endpoints are here for scripting deploys yourself.
Authentication. Send a token as Authorization: Bearer <token>. Create one under Settings, Developer in the dashboard, or get one with the browser-approved login (/auth/device and /auth/token).
Errors. Every response is JSON, errors included: {"error": code, "message": text}.
Rate limits. Every signed-in caller may make 200 requests a minute, counted per user whatever token or address is used (callers without an account: 60 a minute per address). Some endpoints have stricter hourly limits. Over a limit you get 429 with {"error": "rate_limited", "retry_after": seconds} and a Retry-After header; reads are safe to repeat after that long.
The API is early and may change. Pin your CLI version in CI if you depend on its behaviour.
Prefer a machine-readable description? Download the OpenAPI schema. For the command line tool, see How it works.
Account
The signed-in user
GET
/api/v1/me
token required
Example
curl https://djangocloud.dev/api/v1/me \
-H "Authorization: Bearer $TOKEN"
Responses
200 OK
| email | string | |
| subscription_active | boolean | |
| suspended | boolean | |
| plan | string | |
| can_host | boolean | |
| hosted_open | boolean | |
| aws_connected | boolean | |
| setup_step | card | hosting | ready | * card - card
* hosting - hosting
* ready - ready |
| ready_to_deploy | boolean | |
401 Missing or invalid token.
Start putting a card on file
POST
/api/v1/billing/checkout
token required
Answers the Stripe Checkout page to open and the session id to confirm with. If a card is already on file it answers {"active": true}.
Example
curl -X POST https://djangocloud.dev/api/v1/billing/checkout \
-H "Authorization: Bearer $TOKEN"
Responses
200 OK
| active | boolean | True when a card is already on file; there is nothing to open. |
| url | string | The Stripe Checkout page to open. |
| session_id | string | Pass this to /billing/confirm. |
401 Missing or invalid token.
429 Rate limited. Try again later.
502 An upstream service (GitHub, Stripe) is unavailable.
503 Billing is unavailable.
Has the checkout put a card on file?
POST
/api/v1/billing/confirm
token required
What the CLI polls while the user is on the Stripe page: has this checkout session put a card on file?
Request body (application/json)
Example
curl -X POST https://djangocloud.dev/api/v1/billing/confirm \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"session_id": "..."}'
Responses
200 OK
| subscription_active | boolean | |
| suspended | boolean | |
401 Missing or invalid token.
429 Rate limited. Try again later.
Confirm where apps run
POST
/api/v1/setup/hosting
token required
hosted is Fully managed, self is your own AWS account. The plan follows the subscription, so this only confirms the plan the account already has.
Request body (application/json)
| hostingrequired | object | hosted is Fully managed, self your own AWS.
* hosted - hosted
* self - self |
Example
curl -X POST https://djangocloud.dev/api/v1/setup/hosting \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"hosting": {}}'
Responses
200 OK
| email | string | |
| subscription_active | boolean | |
| suspended | boolean | |
| plan | string | |
| can_host | boolean | |
| hosted_open | boolean | |
| aws_connected | boolean | |
| setup_step | card | hosting | ready | * card - card
* hosting - hosting
* ready - ready |
| ready_to_deploy | boolean | |
400 The request is malformed. error says what is wrong.
401 Missing or invalid token.
402 No card on file yet.
403 Not allowed, for example the account is suspended.
409 Conflicts with the current state, for example a deploy is already running.
Your AWS connection and how to set up the role
GET
/api/v1/aws
token required
Returns your ExternalId, the role trust policy, a CloudFormation template and the permissions policy. Never returns a secret key.
Example
curl https://djangocloud.dev/api/v1/aws \
-H "Authorization: Bearer $TOKEN"
Responses
200 OK
| connected | boolean | |
| region | string | |
| account_id | string | |
| method | object | How we reach your account; empty if not connected.
* ` -
* role - role
* key` - key |
| role_arn | string | The IAM role we assume (empty when connected with an access key). |
| access_key | string | The access key id, masked. The secret is never returned. |
| regions | array of object | |
| regions.[]code | string | |
| regions.[]label | string | |
| policy | object | The IAM permissions policy the role (or the access key's user) needs. |
| role_supported | boolean | False if this deployment can't offer the role option. |
| external_id | string | Yours alone. Put it in the role's trust policy. Not a secret. |
| trust_policy | object | The role's trust policy: our principal, with your ExternalId. |
| cloudformation_template | object | Deploy as a stack in your account to create the role, trust policy and permissions in one go. |
401 Missing or invalid token.
Connect your AWS account
PUT
/api/v1/aws
token required
Send role_arn and region. We assume the role with your ExternalId and store no secret; this answers 202 and checks the role in the background, so poll GET /aws until connected is true or error is set. POST does the same.
Request body (application/json)
| role_arnrequired | string | The ARN of the djangocloud-deployer role your CloudFormation stack made. |
| regionrequired | string | For example eu-west-1. |
Example
curl -X PUT https://djangocloud.dev/api/v1/aws \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"role_arn": "...", "region": "..."}'
Responses
200 OK
| connected | boolean | |
| region | string | |
| account_id | string | |
| method | object | How we reach your account; empty if not connected.
* ` -
* role - role
* key` - key |
| role_arn | string | The IAM role we assume (empty when connected with an access key). |
| access_key | string | The access key id, masked. The secret is never returned. |
| regions | array of object | |
| regions.[]code | string | |
| regions.[]label | string | |
202 Accepted: it continues in the background
| connected | boolean | |
| region | string | |
| account_id | string | |
| method | object | How we reach your account; empty if not connected.
* ` -
* role - role
* key` - key |
| role_arn | string | The IAM role we assume (empty when connected with an access key). |
| access_key | string | The access key id, masked. The secret is never returned. |
| regions | array of object | |
| regions.[]code | string | |
| regions.[]label | string | |
| status | string | verifying: poll GET /aws until connected or error. |
400 The request is malformed. error says what is wrong.
401 Missing or invalid token.
429 Rate limited. Try again later.
Projects
List your projects
GET
/api/v1/projects
token required
Example
curl https://djangocloud.dev/api/v1/projects \
-H "Authorization: Bearer $TOKEN"
Responses
200 OK
| projects | array of object | |
| projects.[]id | integer | |
| projects.[]slug | string | |
| projects.[]name | string | |
| projects.[]hosted | boolean | True on Fully managed, false when it runs in your own AWS account. |
| projects.[]region | string | |
| projects.[]power | object | The server size.
* nano - nano
* micro - micro
* small - small
* medium - medium
* large - large
* xlarge - xlarge |
| projects.[]scale | integer | The number of instances. |
| projects.[]resize | object | |
| projects.[]resize.status | idle | pending | applying | failed | * idle - idle
* pending - pending
* applying - applying
* failed - failed |
| projects.[]resize.power | string | The size being applied. |
| projects.[]resize.scale | integer | The instance count being applied. |
| projects.[]resize.error | string | Why the last size change failed, if it did. |
401 Missing or invalid token.
Create a project
POST
/api/v1/projects
token required
Request body (application/json)
| namerequired | string | |
| power | object | * nano - nano
* micro - micro
* small - small
* medium - medium
* large - large
* xlarge - xlarge |
| hosted | boolean | Run it on the Fully managed plan. |
| region | string | Fully managed only: where to run it. |
Example
curl -X POST https://djangocloud.dev/api/v1/projects \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "...", "power": {}, "hosted": true, "region": "..."}'
Responses
201 Created
| id | integer | |
| slug | string | |
| name | string | |
| hosted | boolean | True on Fully managed, false when it runs in your own AWS account. |
| region | string | |
| power | object | The server size.
* nano - nano
* micro - micro
* small - small
* medium - medium
* large - large
* xlarge - xlarge |
| scale | integer | The number of instances. |
| resize | object | |
| resize.status | idle | pending | applying | failed | * idle - idle
* pending - pending
* applying - applying
* failed - failed |
| resize.power | string | The size being applied. |
| resize.scale | integer | The instance count being applied. |
| resize.error | string | Why the last size change failed, if it did. |
400 The request is malformed. error says what is wrong.
401 Missing or invalid token.
402 No card on file yet.
403 Not allowed, for example the account is suspended.
409 Conflicts with the current state, for example a deploy is already running.
The price list
GET
/api/v1/sizes
no token
The server sizes and what they cost. No token is needed.
Example
curl https://djangocloud.dev/api/v1/sizes
Responses
200 OK
| sizes | array of object | |
| sizes.[]power | nano | micro | small | medium | large | xlarge | * nano - nano
* micro - micro
* small - small
* medium - medium
* large - large
* xlarge - xlarge |
| sizes.[]label | string | |
| sizes.[]vcpu | number | |
| sizes.[]ram_gb | number | |
| sizes.[]price_cents | integer | What DjangoCloud charges per instance on Fully managed. |
| sizes.[]aws_cents | integer | What AWS charges you per instance in your own account. |
| sizes.[]description | string | |
Every build setting
GET
/api/v1/build-config
no token
Each setting with its default and description. No token is needed.
Example
curl https://djangocloud.dev/api/v1/build-config
Responses
200 OK
| path | string | Where the settings live in a repository. |
| defaults | object | |
| fields | array of object | |
Tear a project down
DELETE
/api/v1/projects/{project_id}
token required
Deletes the project and everything it left in AWS. This cannot be undone, so the body must repeat the project's slug. A database is deleted after a final snapshot is saved in your AWS account.
Parameters
| project_idrequired | integer · path | |
Example
curl -X DELETE https://djangocloud.dev/api/v1/projects/{project_id} \
-H "Authorization: Bearer $TOKEN"
Responses
202 Accepted: it continues in the background
| slug | string | |
| deleted | boolean | |
400 The request is malformed. error says what is wrong.
401 Missing or invalid token.
404 No such project or release, or it belongs to someone else.
429 Rate limited. Try again later.
A project, whether it is live, and its latest releases
GET
/api/v1/projects/{project_id}
token required
GET: the project, whether it is live and answering, and its latest releases. DELETE: tear it down.
Parameters
| project_idrequired | integer · path | |
Example
curl https://djangocloud.dev/api/v1/projects/{project_id} \
-H "Authorization: Bearer $TOKEN"
Responses
200 OK
| id | integer | |
| slug | string | |
| name | string | |
| hosted | boolean | True on Fully managed, false when it runs in your own AWS account. |
| region | string | |
| power | object | The server size.
* nano - nano
* micro - micro
* small - small
* medium - medium
* large - large
* xlarge - xlarge |
| scale | integer | The number of instances. |
| resize | object | |
| resize.status | idle | pending | applying | failed | * idle - idle
* pending - pending
* applying - applying
* failed - failed |
| resize.power | string | The size being applied. |
| resize.scale | integer | The instance count being applied. |
| resize.error | string | Why the last size change failed, if it did. |
| tier | connect | hosted | * connect - connect
* hosted - hosted |
| url | string | The app's public HTTPS address. |
| status | object | |
| status.label | string | |
| status.tone | string | |
| status.detail | string | |
| health | object | |
| health.state | string | |
| health.checked_at | datetime | |
| health.since | datetime | |
| health.error | string | |
| live_release | object or null | |
| live_release.id | integer | |
| live_release.project_id | integer | |
| live_release.version | integer | The release number: v1, v2, ... |
| live_release.status | queued | building | pushed | deploying | active | superseded | failed | * queued - queued
* building - building
* pushed - pushed
* deploying - deploying
* active - active
* superseded - superseded
* failed - failed |
| live_release.done | boolean | True once the release is active, superseded or failed. |
| live_release.ok | boolean | True when the release is, or was, serving traffic. |
| live_release.git_sha | string | |
| live_release.tests | object | What the CLI reported about the tests it ran before the upload: status (none, passed or skipped), command and seconds. Self-reported. |
| live_release.created_at | datetime | |
| releases | array of object | The latest five releases. |
| releases.[]id | integer | |
| releases.[]project_id | integer | |
| releases.[]version | integer | The release number: v1, v2, ... |
| releases.[]status | queued | building | pushed | deploying | active | superseded | failed | * queued - queued
* building - building
* pushed - pushed
* deploying - deploying
* active - active
* superseded - superseded
* failed - failed |
| releases.[]done | boolean | True once the release is active, superseded or failed. |
| releases.[]ok | boolean | True when the release is, or was, serving traffic. |
| releases.[]git_sha | string | |
| releases.[]tests | object | What the CLI reported about the tests it ran before the upload: status (none, passed or skipped), command and seconds. Self-reported. |
| releases.[]created_at | datetime | |
401 Missing or invalid token.
404 No such project or release, or it belongs to someone else.
Change the server size or the number of instances
POST
/api/v1/projects/{project_id}/scale
token required
Leave a field out to keep its current value. Poll GET /projects/{project_id} and watch resize.status until it is idle or failed.
Parameters
| project_idrequired | integer · path | |
Request body (application/json)
| power | nano | micro | small | medium | large | xlarge | * nano - nano
* micro - micro
* small - small
* medium - medium
* large - large
* xlarge - xlarge |
| scale | integer | |
Example
curl -X POST https://djangocloud.dev/api/v1/projects/{project_id}/scale \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"power": "nano", "scale": 1}'
Responses
200 OK
| id | integer | |
| slug | string | |
| name | string | |
| hosted | boolean | True on Fully managed, false when it runs in your own AWS account. |
| region | string | |
| power | object | The server size.
* nano - nano
* micro - micro
* small - small
* medium - medium
* large - large
* xlarge - xlarge |
| scale | integer | The number of instances. |
| resize | object | |
| resize.status | idle | pending | applying | failed | * idle - idle
* pending - pending
* applying - applying
* failed - failed |
| resize.power | string | The size being applied. |
| resize.scale | integer | The instance count being applied. |
| resize.error | string | Why the last size change failed, if it did. |
202 Accepted: it continues in the background
| id | integer | |
| slug | string | |
| name | string | |
| hosted | boolean | True on Fully managed, false when it runs in your own AWS account. |
| region | string | |
| power | object | The server size.
* nano - nano
* micro - micro
* small - small
* medium - medium
* large - large
* xlarge - xlarge |
| scale | integer | The number of instances. |
| resize | object | |
| resize.status | idle | pending | applying | failed | * idle - idle
* pending - pending
* applying - applying
* failed - failed |
| resize.power | string | The size being applied. |
| resize.scale | integer | The instance count being applied. |
| resize.error | string | Why the last size change failed, if it did. |
400 The request is malformed. error says what is wrong.
401 Missing or invalid token.
402 No card on file yet.
404 No such project or release, or it belongs to someone else.
409 Conflicts with the current state, for example a deploy is already running.
429 Rate limited. Try again later.
Releases
Start a deploy
POST
/api/v1/projects/{project_id}/releases
token required
Upload the source as a .tar.gz in the multipart field source. Without an upload, the latest commit of the project's connected GitHub repository is deployed. Poll /releases/{release_id} until done.
Parameters
| project_idrequired | integer · path | |
Request body (multipart/form-data)
| source | file | The project's source as a .tar.gz. Without it, the latest commit of the connected GitHub repository is deployed. |
| git_sha | string | |
| tests | object | Whether the CLI ran the tests first. Projects that require passing tests refuse anything else.
* none - none
* passed - passed
* skipped - skipped |
| tests_command | string | |
| tests_seconds | integer | |
Example
curl -X POST https://djangocloud.dev/api/v1/projects/{project_id}/releases \
-H "Authorization: Bearer $TOKEN" \
-F source=@project.tar.gz
Responses
202 Accepted: it continues in the background
| id | integer | |
| project_id | integer | |
| version | integer | The release number: v1, v2, ... |
| status | queued | building | pushed | deploying | active | superseded | failed | * queued - queued
* building - building
* pushed - pushed
* deploying - deploying
* active - active
* superseded - superseded
* failed - failed |
| done | boolean | True once the release is active, superseded or failed. |
| ok | boolean | True when the release is, or was, serving traffic. |
| git_sha | string | |
| tests | object | What the CLI reported about the tests it ran before the upload: status (none, passed or skipped), command and seconds. Self-reported. |
| created_at | datetime | |
400 The request is malformed. error says what is wrong.
401 Missing or invalid token.
402 No card on file yet.
404 No such project or release, or it belongs to someone else.
409 Conflicts with the current state, for example a deploy is already running.
413 The upload is too large.
422
429 Rate limited. Try again later.
502 An upstream service (GitHub, Stripe) is unavailable.
Go back to an older release
POST
/api/v1/projects/{project_id}/rollback
token required
Redeploys that release's image as a new release. Code and environment variables go back; database migrations do not. Poll the returned release like a deploy.
Parameters
| project_idrequired | integer · path | |
Request body (application/json)
| versionrequired | integer | The release number to go back to. |
Example
curl -X POST https://djangocloud.dev/api/v1/projects/{project_id}/rollback \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"version": 1}'
Responses
202 Accepted: it continues in the background
| id | integer | |
| project_id | integer | |
| version | integer | The release number: v1, v2, ... |
| status | queued | building | pushed | deploying | active | superseded | failed | * queued - queued
* building - building
* pushed - pushed
* deploying - deploying
* active - active
* superseded - superseded
* failed - failed |
| done | boolean | True once the release is active, superseded or failed. |
| ok | boolean | True when the release is, or was, serving traffic. |
| git_sha | string | |
| tests | object | What the CLI reported about the tests it ran before the upload: status (none, passed or skipped), command and seconds. Self-reported. |
| created_at | datetime | |
400 The request is malformed. error says what is wrong.
401 Missing or invalid token.
404 No such project or release, or it belongs to someone else.
409 Conflicts with the current state, for example a deploy is already running.
429 Rate limited. Try again later.
A release and the log lines since a cursor
GET
/api/v1/releases/{release_id}
token required
Status plus the log lines since ?after=<cursor>; the CLI polls until done.
Parameters
| after | integer · query | A cursor from an earlier answer: only newer lines come back. |
| release_idrequired | integer · path | |
Example
curl https://djangocloud.dev/api/v1/releases/{release_id} \
-H "Authorization: Bearer $TOKEN"
Responses
200 OK
| id | integer | |
| project_id | integer | |
| version | integer | The release number: v1, v2, ... |
| status | queued | building | pushed | deploying | active | superseded | failed | * queued - queued
* building - building
* pushed - pushed
* deploying - deploying
* active - active
* superseded - superseded
* failed - failed |
| done | boolean | True once the release is active, superseded or failed. |
| ok | boolean | True when the release is, or was, serving traffic. |
| git_sha | string | |
| tests | object | What the CLI reported about the tests it ran before the upload: status (none, passed or skipped), command and seconds. Self-reported. |
| created_at | datetime | |
| logs | array of object | Up to 500 new lines. |
| logs.[]id | integer | |
| logs.[]at | datetime | |
| logs.[]level | string | |
| logs.[]message | string | |
| cursor | integer | Pass as after next time. |
401 Missing or invalid token.
404 No such project or release, or it belongs to someone else.
Environment
Remove environment variables by name
DELETE
/api/v1/projects/{project_id}/env
token required
Unknown names are ignored. The variables DjangoCloud manages (the database's) are never removed. Applied from the next deploy.
Parameters
| project_idrequired | integer · path | |
Example
curl -X DELETE https://djangocloud.dev/api/v1/projects/{project_id}/env \
-H "Authorization: Bearer $TOKEN"
Responses
200 OK
| created | array of string | |
| updated | array of string | |
| removed | array of string | |
400 The request is malformed. error says what is wrong.
401 Missing or invalid token.
404 No such project or release, or it belongs to someone else.
429 Rate limited. Try again later.
The names of the environment variables
GET
/api/v1/projects/{project_id}/env
token required
Never returns values.
Parameters
| project_idrequired | integer · path | |
Example
curl https://djangocloud.dev/api/v1/projects/{project_id}/env \
-H "Authorization: Bearer $TOKEN"
Responses
200 OK
| variables | array of object | |
| variables.[]key | string | |
| variables.[]updated_at | datetime | |
| max | integer | The most variables one project can hold. |
401 Missing or invalid token.
404 No such project or release, or it belongs to someone else.
Set environment variables
PUT
/api/v1/projects/{project_id}/env
token required
Encrypted, all or nothing, and applied from the next deploy. With replace the others are removed, except the ones DjangoCloud manages.
Parameters
| project_idrequired | integer · path | |
Request body (application/json)
| variablesrequired | object | KEY: value pairs. |
| replace | boolean | Remove the other variables. |
Example
curl -X PUT https://djangocloud.dev/api/v1/projects/{project_id}/env \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"variables": {}, "replace": true}'
Responses
200 OK
| created | array of string | |
| updated | array of string | |
| removed | array of string | |
400 The request is malformed. error says what is wrong.
401 Missing or invalid token.
404 No such project or release, or it belongs to someone else.
429 Rate limited. Try again later.
Operations
The autoscaling settings
GET
/api/v1/projects/{project_id}/autoscale
token required
GET the autoscaling settings. PUT {"enabled": true, "min": 2, "max": 6}; turning it off keeps the range.
Parameters
| project_idrequired | integer · path | |
Example
curl https://djangocloud.dev/api/v1/projects/{project_id}/autoscale \
-H "Authorization: Bearer $TOKEN"
Responses
200 OK
| enabled | boolean | |
| min | integer | |
| max | integer | |
| note | string | What autoscaling is doing right now, if anything. |
| max_allowed | integer | The most instances one project can have. |
401 Missing or invalid token.
404 No such project or release, or it belongs to someone else.
Turn autoscaling on or off, and set its range
PUT
/api/v1/projects/{project_id}/autoscale
token required
GET the autoscaling settings. PUT {"enabled": true, "min": 2, "max": 6}; turning it off keeps the range.
Parameters
| project_idrequired | integer · path | |
Request body (application/json)
| enabledrequired | boolean | Turning it off keeps the range. |
| min | integer | |
| max | integer | |
Example
curl -X PUT https://djangocloud.dev/api/v1/projects/{project_id}/autoscale \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"enabled": true, "min": 1, "max": 1}'
Responses
200 OK
| enabled | boolean | |
| min | integer | |
| max | integer | |
| note | string | What autoscaling is doing right now, if anything. |
| max_allowed | integer | The most instances one project can have. |
400 The request is malformed. error says what is wrong.
401 Missing or invalid token.
404 No such project or release, or it belongs to someone else.
The usage alert settings
GET
/api/v1/projects/{project_id}/alerts
token required
GET the alert settings. PUT {"enabled": true, "cpu": 80, "memory": 85, "downtime": true}; any may be left
out to keep what is there. Limits are percent of the allocated size.
Parameters
| project_idrequired | integer · path | |
Example
curl https://djangocloud.dev/api/v1/projects/{project_id}/alerts \
-H "Authorization: Bearer $TOKEN"
Responses
200 OK
| enabled | boolean | |
| cpu | integer | Percent of the allocated size. |
| memory | integer | Percent of the allocated size. |
| downtime | boolean | Also alert when the app stops answering. |
| firing | boolean | True while a usage alert is active. |
401 Missing or invalid token.
404 No such project or release, or it belongs to someone else.
Change the usage alert settings
PUT
/api/v1/projects/{project_id}/alerts
token required
Leave a field out to keep what is there. Limits are percent of the allocated size.
Parameters
| project_idrequired | integer · path | |
Request body (application/json)
| enabled | boolean | |
| cpu | integer | |
| memory | integer | |
| downtime | boolean | |
Example
curl -X PUT https://djangocloud.dev/api/v1/projects/{project_id}/alerts \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"enabled": true, "cpu": 1, "memory": 1, "downtime": true}'
Responses
200 OK
| enabled | boolean | |
| cpu | integer | Percent of the allocated size. |
| memory | integer | Percent of the allocated size. |
| downtime | boolean | Also alert when the app stops answering. |
| firing | boolean | True while a usage alert is active. |
400 The request is malformed. error says what is wrong.
401 Missing or invalid token.
404 No such project or release, or it belongs to someone else.
Whether deploys must have passing tests
GET
/api/v1/projects/{project_id}/tests
token required
GET the policy and the latest reported test run. PUT {"require": true} refuses deploys unless the CLI
reports that the tests passed. The report is self-reported: this guards against mistakes, not against a person
who sends the flag without running anything.
Parameters
| project_idrequired | integer · path | |
Example
curl https://djangocloud.dev/api/v1/projects/{project_id}/tests \
-H "Authorization: Bearer $TOKEN"
Responses
200 OK
| require | boolean | Deploys are refused unless the CLI reports that the tests passed. |
| last | object or null | The latest release that reported a test run: its version, status, command. |
401 Missing or invalid token.
404 No such project or release, or it belongs to someone else.
Require passing tests for deploys, or stop requiring them
PUT
/api/v1/projects/{project_id}/tests
token required
The CLI reports the result of the tests it ran; this is self-reported, so it guards against mistakes rather than against someone who sends the flag without running anything.
Parameters
| project_idrequired | integer · path | |
Request body (application/json)
Example
curl -X PUT https://djangocloud.dev/api/v1/projects/{project_id}/tests \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"require": true}'
Responses
200 OK
| require | boolean | Deploys are refused unless the CLI reports that the tests passed. |
| last | object or null | The latest release that reported a test run: its version, status, command. |
400 The request is malformed. error says what is wrong.
401 Missing or invalid token.
404 No such project or release, or it belongs to someone else.
CPU and memory, as percent of the server size
GET
/api/v1/projects/{project_id}/metrics
token required
CPU and memory (percent of the allocated size) for since (default 1h, e.g. 30m, 6h, 7d; at most 30d), oldest
first, thinned to at most 500 points. latest is the newest sample, whatever its age.
Parameters
| project_idrequired | integer · path | |
| since | string · query | How far back, for example 30m, 6h or 7d (default 1h, at most 30 days). |
Example
curl https://djangocloud.dev/api/v1/projects/{project_id}/metrics \
-H "Authorization: Bearer $TOKEN"
Responses
200 OK
| power | string | |
| scale | integer | |
| alerts | object | |
| alerts.enabled | boolean | |
| alerts.cpu | integer | Percent of the allocated size. |
| alerts.memory | integer | Percent of the allocated size. |
| alerts.downtime | boolean | Also alert when the app stops answering. |
| alerts.firing | boolean | True while a usage alert is active. |
| latest | object or null | The newest sample, whatever its age. |
| latest.at | datetime | |
| latest.cpu | number | Percent of the allocated size. |
| latest.memory | number | Percent of the allocated size. |
| points | array of object | Oldest first, thinned to at most 500 points. |
| points.[]at | datetime | |
| points.[]cpu | number | Percent of the allocated size. |
| points.[]memory | number | Percent of the allocated size. |
400 The request is malformed. error says what is wrong.
401 Missing or invalid token.
404 No such project or release, or it belongs to someone else.
Database
The project's database
GET
/api/v1/projects/{project_id}/database
token required
Parameters
| project_idrequired | integer · path | |
Example
curl https://djangocloud.dev/api/v1/projects/{project_id}/database \
-H "Authorization: Bearer $TOKEN"
Responses
200 OK
| size | string | |
| ha | boolean | High availability: a standby in a second zone. |
| ready | boolean | |
| removing | boolean | |
| open_until | datetime | When the public endpoint locks again. |
| network_pending | object | |
| snapshot_pending | boolean | |
| aws_error | string | |
| state | string | |
| public | boolean | |
| endpoint | string | |
| last_snapshot | object or null | |
| last_snapshot.name | string | |
| last_snapshot.created_at | datetime | |
| last_snapshot.state | string | |
| latest_restorable | datetime | |
401 Missing or invalid token.
404 No such project or release, or it belongs to someone else.
Open or lock the database's public endpoint
POST
/api/v1/projects/{project_id}/database/network
token required
{"public": true} opens the database's public endpoint for an hour (it locks again by itself, see
projects.tasks.lock_databases); {"public": false} locks it now, which also cuts off the app until it is opened.
Parameters
| project_idrequired | integer · path | |
Request body (application/json)
| publicrequired | boolean | true opens the public endpoint for an hour, then it locks by itself. false locks it now, which also cuts off the app until it is opened. |
Example
curl -X POST https://djangocloud.dev/api/v1/projects/{project_id}/database/network \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"public": true}'
Responses
202 Accepted: it continues in the background
| size | string | |
| ha | boolean | High availability: a standby in a second zone. |
| ready | boolean | |
| removing | boolean | |
| open_until | datetime | When the public endpoint locks again. |
| network_pending | object | |
| snapshot_pending | boolean | |
| aws_error | string | |
| state | string | |
| public | boolean | |
| endpoint | string | |
| last_snapshot | object or null | |
| last_snapshot.name | string | |
| last_snapshot.created_at | datetime | |
| last_snapshot.state | string | |
| latest_restorable | datetime | |
400 The request is malformed. error says what is wrong.
401 Missing or invalid token.
404 No such project or release, or it belongs to someone else.
409 Conflicts with the current state, for example a deploy is already running.
429 Rate limited. Try again later.
Take a manual snapshot
POST
/api/v1/projects/{project_id}/database/snapshot
token required
snapshot_pending is true until it is done, then last_snapshot shows it. One at a time.
Parameters
| project_idrequired | integer · path | |
Example
curl -X POST https://djangocloud.dev/api/v1/projects/{project_id}/database/snapshot \
-H "Authorization: Bearer $TOKEN"
Responses
202 Accepted: it continues in the background
| size | string | |
| ha | boolean | High availability: a standby in a second zone. |
| ready | boolean | |
| removing | boolean | |
| open_until | datetime | When the public endpoint locks again. |
| network_pending | object | |
| snapshot_pending | boolean | |
| aws_error | string | |
| state | string | |
| public | boolean | |
| endpoint | string | |
| last_snapshot | object or null | |
| last_snapshot.name | string | |
| last_snapshot.created_at | datetime | |
| last_snapshot.state | string | |
| latest_restorable | datetime | |
401 Missing or invalid token.
404 No such project or release, or it belongs to someone else.
409 Conflicts with the current state, for example a deploy is already running.
429 Rate limited. Try again later.