When to use API Keys

You should use API Keys whenever you are trying to make an API request to any endpoints of Morph API.


How to use API Keys

Managing your API Keys

You can create any number of API keys, and delete them at any time.

❗️

Keep your API Key secure

You API Keys are secret credentials.

Unsafe practices:

  • ⛔ Do not share your API Key in code accessible shared publicly such as GitHub.
  • ⛔ Never store the API Key in your source code nor commit it in version control.

Recommended practices:

  • 🆗 Read API Keys from environment variables.
  • 🆗 Use a secret manager or a deployment system to define your API Key in the environment.

Using your API Keys

Every request to any endpoint of Morph API must be authenticated with an API Key set in the x-api-key header:

--header "x-api-key: {YOUR_API_KEY}"

Example within a request to the Query Records endpoint.

curl --X POST "https://{YOUR_TEAM_SLUG}.api.morphdb.io/v0/data-api/record/query" \
--header "Content-Type: application/json" \
--header "x-api-key: {YOUR_API_KEY}" \
--data "{
    \"select\":[\"*\"],
    \"sort\":[],
    \"limit\":5,
    \"skip\":0
}
"

Data API Key

Create an API Key

Once you create Data API in Morph dashboard, API Key will be generated automatically. You can find API Key for each endpoint in the setting page of Data API.

As you can see in the below screenshot, API Key can be copied in dashboard.


Delete an API Key

When you delete Data API from your database, API Key associated with the Data API is removed automatically.

You will be asked to confirm your choice before the API Key is deleted.

❗️

The deletion of API Keys is permanent


Next steps

  • Follow the Quickstart tutorial to make your first request to Morph API.