API Reference

The Drift REST API provides full programmatic access to all platform features.

Base URL#

https://api.drift.velozengineering.ch/v1

Authentication#

All authenticated endpoints require a JWT bearer token or an API key. Obtain a token via the login endpoint:

curl -X POST https://api.drift.velozengineering.ch/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email": "[email protected]", "password": "secret"}'

# Response:
# {"token": "eyJhbGciOi...", "user": {"id": "...", "email": "[email protected]"}}

Use the token in subsequent requests:

curl -H "Authorization: Bearer eyJhbGciOi..." \
  https://api.drift.velozengineering.ch/v1/orgs

API Keys

For CI/CD and automation, use API keys instead of user tokens. Create one with drift create-api-key or POST /v1/api-keys.

Error Format#

All errors return a JSON object with a status code, error code, and message:

{
  "code": "NOT_FOUND",
  "message": "app \"myapp\" not found"
}

Rate Limiting#

The API enforces rate limiting per authenticated user. If you exceed the limit, you'll receive a429 Too Many Requests response.

Endpoints#

Authentication#

POST
/v1/auth/login

Login and receive a JWT token

GET
/v1/auth/me

Get current user info

Organizations#

GET
/v1/orgs

List organizations

POST
/v1/orgs

Create an organization

GET
/v1/orgs/{id}

Get organization details

DELETE
/v1/orgs/{id}

Delete an organization

GET
/v1/orgs/{id}/users

List org users with roles

PUT
/v1/orgs/{id}/users/{uid}/roles

Set org roles for a user

Spaces#

GET
/v1/orgs/{orgId}/spaces

List spaces in an org

POST
/v1/orgs/{orgId}/spaces

Create a space

GET
/v1/spaces/{id}

Get space details

DELETE
/v1/spaces/{id}

Delete a space

GET
/v1/spaces/{id}/users

List space users with roles

PUT
/v1/spaces/{id}/users/{uid}/roles

Set space roles for a user

Applications#

GET
/v1/spaces/{spaceId}/apps

List apps in a space

POST
/v1/spaces/{spaceId}/apps

Push (create/update) an app

GET
/v1/apps/{id}

Get app details

DELETE
/v1/apps/{id}

Delete an app

POST
/v1/apps/{id}/start

Start an app

POST
/v1/apps/{id}/stop

Stop an app

POST
/v1/apps/{id}/restart

Rolling restart an app

PUT
/v1/apps/{id}/scale

Scale instances/memory

GET
/v1/apps/{id}/env

Get environment variables

PUT
/v1/apps/{id}/env

Set environment variables (bulk)

PUT
/v1/apps/{id}/env/{key}

Set a single environment variable

PUT
/v1/apps/{id}/health

Set health check configuration

GET
/v1/apps/{id}/logs

Get app logs (supports SSE streaming)

GET
/v1/apps/{id}/stats

Get app instance stats (CPU, memory)

GET
/v1/apps/{id}/exec

WebSocket shell (SSH)

Services#

GET
/v1/marketplace

List available services and plans

GET
/v1/spaces/{spaceId}/services

List service instances in a space

POST
/v1/spaces/{spaceId}/services

Create a service instance

GET
/v1/services/{id}

Get service instance details

DELETE
/v1/services/{id}

Delete a service instance

Service Bindings#

POST
/v1/apps/{appId}/bindings

Bind a service to an app

GET
/v1/apps/{appId}/bindings

List bindings for an app

DELETE
/v1/bindings/{id}

Delete a binding

Service Sharing#

POST
/v1/services/{id}/shares

Share a service to another space

GET
/v1/services/{id}/shares

List shares for a service

DELETE
/v1/services/{id}/shares/{shareId}

Remove a share

Service Keys#

POST
/v1/services/{id}/keys

Create a service key

GET
/v1/services/{id}/keys

List service keys

GET
/v1/service-keys/{keyId}

Get service key credentials

DELETE
/v1/service-keys/{keyId}

Delete a service key

Routes & Domains#

GET
/v1/domains

List available domains

POST
/v1/domains

Create a domain

DELETE
/v1/domains/{id}

Delete a domain

GET
/v1/spaces/{spaceId}/routes

List routes in a space

GET
/v1/apps/{appId}/routes

List routes for an app

POST
/v1/apps/{appId}/routes

Map a route to an app

DELETE
/v1/routes/{routeId}/mappings/{appId}

Unmap a route from an app

Events#

GET
/v1/spaces/{spaceId}/events

List events in a space

GET
/v1/orgs/{orgId}/events

List events in an org

Billing#

GET
/v1/plans

List available billing plans

GET
/v1/orgs/{orgId}/subscription

Get current subscription

POST
/v1/orgs/{orgId}/subscription

Create or change subscription

DELETE
/v1/orgs/{orgId}/subscription

Cancel subscription

GET
/v1/orgs/{orgId}/usage

Get current resource usage

GET
/v1/orgs/{orgId}/invoices

List invoices

API Keys#

POST
/v1/api-keys

Create an API key

GET
/v1/api-keys

List API keys

DELETE
/v1/api-keys/{id}

Delete an API key

Webhooks#

POST
/v1/orgs/{orgId}/webhooks

Create a webhook

GET
/v1/orgs/{orgId}/webhooks

List webhooks

PATCH
/v1/webhooks/{id}

Update a webhook

DELETE
/v1/webhooks/{id}

Delete a webhook

GET
/v1/webhooks/{id}/deliveries

List webhook deliveries

Admin (requires admin role)#

GET
/v1/service-brokers

List service brokers

POST
/v1/service-brokers

Register a service broker

DELETE
/v1/service-brokers/{name}

Delete a service broker

POST
/v1/admin/users

Create a user

GET
/v1/admin/users

List all users

GET
/v1/quotas

List quotas

GET
/v1/quotas/{name}

Get quota details

POST
/v1/admin/quotas

Create a quota

PUT
/v1/admin/orgs/{id}/quota

Set quota for an org

Health & Metrics#

GET
/healthz

Simple health check (returns 'ok')

GET
/health

Detailed health check

GET
/metrics

Prometheus metrics endpoint