Compose Database-as-a-Service Help and Documentation

Everything you need to know about Compose, Hosted or Enterprise, is here in our help system. Whether you run one database for your businesses' sole application or six different databases to support an entire corporation, we've got the information you need.

This is the older REST API and is now deprecated.

Go to the dedicated apidocs.compose.com for details of the current API which works with all Compose databases with the exception of the MongoDB Classic deployments.

Endpoint Description
GET /accounts List your accounts
GET /accounts/:account Get details for an account
PATCH /accounts/:account Change the name of an account
GET /accounts/:account/invoices List invoices
GET /accounts/:account/coupons Get details about any redeemed coupons
GET /accounts/:account/activity Show all account activity

GET /accounts

List the accounts available to your access token.

Accounts and API access tokens are currently one-to-one, so you should always receive a JSON array containing exactly one object. This is useful however for determining the id or slug of your account.

Request

curl -i -X GET 'https://api.compose.io/accounts' \
-H 'Content-Type: application/json' \
-H 'Accept-Version: 2014-06' \
-H 'Authorization: Bearer [OAUTH_TOKEN]'

Response

[
  {
    "id": "1234567890",
    "name": "Your Account",
    "slug": "your-account",
    "active": true,
    "created_at": "2010-09-23T15:58:42+00:00",
    "owner_id": "12345",
    "owner": "Your User's Name"
  }
]

GET /accounts/:account

Get details for an account by its slug or id (see above).

Param
Description

:account

slug or id for an account

Request

curl -i -X GET 'https://api.compose.io/accounts/your-account' \
-H 'Content-Type: application/json' \
-H 'Accept-Version: 2014-06' \
-H 'Authorization: Bearer [OAUTH_TOKEN]'

Response

{
  "id": "1234567890",
  "name": "Your Account",
  "slug": "your-account",
  "active": true,
  "created_at": "2010-09-23T15:58:42+00:00",
  "owner_id": "12345",
  "owner": "Your User's Name"
}

PATCH /accounts/:account

Change the name on an account.

Param
Description

:account

slug or id for an account

Request

curl -i -X PATCH 'https://api.compose.io/accounts/your-account' \
-H 'Content-Type: application/json' \
-H 'Accept-Version: 2014-06' \
-H 'Authorization: Bearer [OAUTH_TOKEN]' \
-d '{"name":"ACME Corp."}'

Response

{
  "id": "1234567890",
  "name": "ACME Corp.",
  "slug": "your-account",
  "active": true,
  "created_at": "2010-09-23T15:58:42+00:00",
  "owner_id": "12345",
  "owner": "Your User's Name"
}

GET /accounts/:account/invoices

List invoices on an account.

Param
Description

:account

slug or id for an account

Request

curl -i -X GET 'https://api.compose.io/accounts/your-account/invoices' \
-H 'Content-Type: application/json' \
-H 'Accept-Version: 2014-06' \
-H 'Authorization: Bearer [OAUTH_TOKEN]'

Response

[
  {
    "id": "12345",
    "start_at": "2014-05-01T00:00:00+00:00",
    "amount": "31.04",
    "balance": "0.0",
    "invoice_items": [
      {
        "id": "12345",
        "description": "Mongo::Deployment (1GB)",
        "end_at": "2014-07-01T00:00:00+00:00",
        "start_at": "2014-06-01T00:00:00+00:00",
        "sku": "Mongo::Deployment"
      }
    ]
  }
]

GET /accounts/:account/coupons

List the coupons that have been redeemed on an account.

Param
Description

:account

slug or id for an account

Request

curl -i -X GET 'https://api.compose.io/accounts/your-account/coupons' \
-H 'Content-Type: application/json' \
-H 'Accept-Version: 2014-06' \
-H 'Authorization: Bearer [OAUTH_TOKEN]'

Response

[
  {
    "id": "12345",
    "redeemed_at": "2014-05-01T00:00:00+00:00",
    "value": "50.0",
    "balance": "25.0"
  }
]

GET /accounts/:account/activity

List the events that have occurred on an account.

Param
Description

:account

slug or id for an account

Request

curl -i -X GET 'https://api.compose.io/accounts/your-account/activity' \
-H 'Content-Type: application/json' \
-H 'Accept-Version: 2014-06' \
-H 'Authorization: Bearer [OAUTH_TOKEN]'

Response

[
  {
    "id": "12345",
    "event": "event.type",
    "data": null,
    "email": "user@email.com",
    "database_name": null,
    "created_at": "2014-06-12T14:56:39+00:00",
    "ip": "10.0.0.1"
  }
]

Event Types

Type
Description

user.login

User logged in

oauth.create_token

OAuth access token created for a user

oauth.create_authorization_code

OAuth authorization code created for a user


Still Need Help?

If this article didn't solve things, summon a human and get some help!

Accounts