---
title: "Authentication"
description: "Create an application, generate credentials, and send them with every request."
url: "https://nov18-prod-sg.movespot.fyi/guides/authentication"
image: "https://nov18-prod-sg.movespot.fyi/_og/d/c_Ocean.takumi,title_Authentication,description_~Q3JlYXRlIGFuIGFwcGxpY2F0aW9uLCBnZW5lcmF0ZSBjcmVkZW50aWFscywgYW5kIHNlbmQgdGhlbSB3aXRoIGV2ZXJ5IHJlcXVlc3Qu,props_eyJ0aGVtZSI6eyJtb2RlIjoibGlnaHQiLCJjb2xvcnMiOnsicHJpbWFyeSI6IiNDQjUzMjQifX19,p_Ii9ndWlkZXMvYXV0aGVudGljYXRpb24i,s_ha1I6ufv6PghxK85.png"
---

# Authentication

Create an application, generate credentials, and send them with every request.

## [Choose your credential type](#choose-your-credential-type)

Every API accepts one of two credential types. Check the authentication section of each API's reference page to see which one it uses:

| Credential                   | Best for                                | How it works                                                 |
| :--------------------------- | :-------------------------------------- | :----------------------------------------------------------- |
| API key                      | Server-to-server calls                  | A long-lived key you send in the Authorization header        |
| OAuth 2.0 client credentials | User-facing apps and short-lived access | Exchange your client ID and secret for a scoped access token |

## [API keys](#api-keys)

Generate an API key from your application page:

1.  Open [My applications](https://nov18-prod-sg.movespot.fyi/apps) and select your application.
2.  Select **Generate key** and give it a name, such as `production` or `staging`.
3.  Copy the key immediately. You can only see it once.

Send the key with every request:

```bash
curl "https://api.example.com/v1/orders" \
  -H "Authorization: Bearer $API_KEY"
```

Rotate keys regularly

Rotate keys at least every 90 days. If a key is ever exposed, revoke it from the application page right away and generate a new one.

## [OAuth 2.0 client credentials](#oauth-20-client-credentials)

If an API uses OAuth 2.0, exchange your client credentials for a short-lived access token:

```bash
curl "https://api.example.com/oauth/token" \
  -d "grant_type=client_credentials" \
  -d "client_id=$CLIENT_ID" \
  -d "client_secret=$CLIENT_SECRET"
```

The response includes an access token and its expiry:

```json
{
  "access_token": "tok_9f8e7d",
  "expires_in": 3600,
  "token_type": "Bearer"
}
```

Send the token instead of the key:

```bash
curl "https://api.example.com/v1/orders" \
  -H "Authorization: Bearer $ACCESS_TOKEN"
```

Tokens expire after one hour. Cache them in your application and refresh them before they lapse, rather than requesting a new one on every call.

## [Keep your credentials safe](#keep-your-credentials-safe)

-   Store secrets in a secrets manager or environment variables, never in source control.
-   Use a separate key for each environment, so a staging incident never touches production.
-   Revoke keys you no longer use.

## [Next steps](#next-steps)

### Make your first request

Walk through a complete request and response, headers to status codes.

<https://nov18-prod-sg.movespot.fyi/guides/first-request>

### Applications and credentials

How applications, API registrations, and credentials fit together.

<https://nov18-prod-sg.movespot.fyi/guides/applications>

### Errors

Understand error responses and decide which requests to retry.

<https://nov18-prod-sg.movespot.fyi/guides/errors>