> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.middesk.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.middesk.com/_mcp/server.

# Get and use your API keys

> Learn where to find and how to use your Middesk API keys.

Authenticate your requests to the Middesk API using API keys. Middesk provisions two keys when your account is created: one for sandbox and one for production.

#### Find your API keys

You can access your API keys in the Middesk [Dashboard](https://app.middesk.com/settings/credentials), under **Settings** > **Developer** > **Credentials**.

You can also create new API keys on that page.

#### Use your API keys

API authentication is generally performed using HTTP Basic Auth. Provide the API key as the username value.

You can also use Bearer Auth. Pass a header value of `Authorization: Bearer mk_live_YOUR_API_KEY`.

Neither approach requires a password, but all API requests should be made over HTTPS.

**`Basic Auth`**

```curl title="Basic Auth"
curl https://api.middesk.com/v1/businesses \
  -u mk_live_YOUR_API_KEY:
```

**`Bearer Auth`**

```curl title="Bearer Auth"
curl https://api.middesk.com/v1/businesses \
  -H 'Authorization: Bearer mk_live_YOUR_API_KEY'
```

#### Match API keys to the environment

To support your development cycles, the API has two [environments](/environments) (or modes):

* Sandbox, to test your integration with mock data before going live
* Production (or live), for real businesses and requests

The two provisioned keys in your account match these two environments;

* `Test API key` (prefixed `mk_test`) for sandbox mode, for use with `https://api-sandbox.middesk.com/v1/` requests
* `Live API key` (prefixed `mk_live`) for production, for use with `https://api.middesk.com/v1/` requests

The API key type and URL must match. You cannot use a production key with a sandbox URL or the other way around.

#### Get a demo

Contact your account manager or [contact sales](https://www.middesk.com/contact-sales) to inquire about access.