> ## Documentation Index
> Fetch the complete documentation index at: https://docs.emailx.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Your first request

> From a scoped key to a workspace you can read.

The Emailx API uses `https://app.emailx.ai`. Production access is not enabled in the current beta: a request can return `503 api_disabled`. Ask your Emailx contact for an enabled environment and its matching key before continuing. A test key and a production key are not interchangeable.

**1. Request beta access**

Create an expiring key in Emailx under [Settings > API keys](https://docs.emailx.ai/en/overview/authentication.md#create-a-key). For this quickstart, choose `workspaces:read` and `campaigns:read`. Agency client access also needs `agency:read` and a current assignment.

**2. Choose the correct environment**

Use the canonical application origin for an enabled production account:

```bash theme={null}
export EMAILX_BASE_URL="https://app.emailx.ai"
```

Load `EMAILX_API_KEY` from your secret manager. Never put a key in a URL, committed file, or copied support log. Production access requires a separately enabled account and key. A test key reads real staging records; it does not create a sandbox.

**3. Check your connection**

```bash cURL theme={null}
curl "$EMAILX_BASE_URL/api/v1/me" \
  -H "Authorization: Bearer $EMAILX_API_KEY"
```

```python Python theme={null}
import json, os, urllib.request
request = urllib.request.Request(
    os.environ["EMAILX_BASE_URL"] + "/api/v1/me",
    headers={"Authorization": "Bearer " + os.environ["EMAILX_API_KEY"]},
)
with urllib.request.urlopen(request, timeout=30) as response:
    print(json.load(response))
```

```javascript JavaScript theme={null}
const response = await fetch(`${process.env.EMAILX_BASE_URL}/api/v1/me`, {
  headers: { Authorization: `Bearer ${process.env.EMAILX_API_KEY}` },
  signal: AbortSignal.timeout(30000),
});
if (!response.ok) throw new Error(`Emailx: ${response.status}`);
console.log(await response.json());
```

A successful response wraps credential metadata in `data`. Check the environment, expiry and scopes before continuing. See [Inspect your API key](https://docs.emailx.ai/en/api-reference/start/check-api-key.md) for the response fields.

**4. Discover current access**

```bash theme={null}
curl "$EMAILX_BASE_URL/api/v1/workspaces?limit=25" \
  -H "Authorization: Bearer $EMAILX_API_KEY"
```

Choose an ID from `data`. Configured grants on the credential are an upper bound; this list reflects current access.

**5. Read a channel's campaigns**

Replace `123` with the workspace ID you just received.

```bash theme={null}
curl "$EMAILX_BASE_URL/api/v1/workspaces/123/campaigns?channel=linkedin&limit=25" \
  -H "Authorization: Bearer $EMAILX_API_KEY"
```

An empty `data` array is a valid result. Use `next_cursor` when `has_more` is true.

## Next steps

[Prepare a draft](https://docs.emailx.ai/en/overview/workflows.md), [handle pagination](https://docs.emailx.ai/en/api-reference/pagination.md), or [install the CLI](https://docs.emailx.ai/en/cli/installation.md). Run API requests from your backend or terminal; browser session cookies do not authenticate them.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.