Developer
Use API Key

Introduction

You can interact with our GraphQL API / REST API by sending HTTP requests in any language. Before using it, you need to create an API Key in the Dashboard (opens in a new tab).

Creating API Key

In Dashboard (opens in a new tab), click on Settings in the dropdown menu on the right, then click on Developer in the sidebar on the left to see the developer options.

Developer Panel

Find the API Key area, and click the Generate New Token button to generate an API Key.

Generate API Key

Click the View button to view the API Key.

View API Key

Click the Copy button to copy the API Key.

Copy API Key

Using API Key

Authentication

Zeabur API can optionally use the API Key for authentication. Ensure you have generated a valid API Key.

All API requests should include your API Key in the Authorization HTTP header as shown below:

Authorization: Bearer ZEABUR_API_KEY

Sending a REST API Request

You can use any HTTP client library or within your application to send requests. Here is an example:

You can paste the following command into the terminal to run your first REST API request. Be sure to replace $ZEABUR_API_KEY with your API Key:

curl https://gateway.zeabur.com/api/v1/users/me \
  -H "Authorization: Bearer $ZEABUR_API_KEY" \
  -H "Content-Type: application/json" \

This queries the current user's information. You should receive a response similar to the following:

{
    "_id": "64ffffffffffffffffff",
    "name": "Zeabur Zebra",
    "email": "zebra@zeabur.com",
    "username": "zeabra",
    "language": "en-US",
    "githubID": 5000000,
    "avatarUrl": "https://avatars.githubusercontent.com/u/5000000?v=4",
    "createdAt": "2023-08-31T08:14:08.873Z",
    "bannedAt": null,
    "bannedReason": null,
    "emailPreference": {
        "buildFailed": true,
        "deploymentCrashed": true
    },
    "agreedAt": "2023-08-31T08:14:17.028Z",
    "referralCode": "zeabra",
    "discordID": "7000000000000000000",
    "customerID": "cus_xxxxxxxxxxxxxx"
}

Now that you have successfully authenticated with the API Key, you can use the API Key to access other REST APIs.

The access method for the GrapQL API is the same as above, but the request method is different. You can try the GraphQL API in the GraphQL Playground (opens in a new tab).