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

# Your first call

> Three calls, from checking your key to reading your organization and its usage this month.

In a few minutes you will check your API key, read your organization and read its usage this month. Each step shows
the call in curl, Python, PHP and JavaScript; choose your language once and every step follows it.

> [!NOTE]
>
> You need an API key of your organization. If you have none, [create one](https://developers.readyforcommerce.com/authentication.md#create-a-key) and put it in
> the environment variable `RFC_API_KEY`:
>
> ```bash theme={null}
> export RFC_API_KEY="<your key>"
> ```

**1. Check your key**

[Get the calling credential](https://developers.readyforcommerce.com/api-reference/core-get-credential.md) answers who your key is. It counts against no
limit.

```bash curl theme={null}
curl https://app.readyforcommerce.com/api/v1/credential \
  --header "Authorization: Bearer $RFC_API_KEY"
```

```python Python theme={null}
import os

import requests

response = requests.get(
    "https://app.readyforcommerce.com/api/v1/credential",
    headers={"Authorization": f"Bearer {os.environ['RFC_API_KEY']}"},
)
print(response.json())
```

```php PHP theme={null}
<?php
$curl = curl_init('https://app.readyforcommerce.com/api/v1/credential');
curl_setopt_array($curl, [
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('RFC_API_KEY')],
    CURLOPT_RETURNTRANSFER => true,
]);
echo curl_exec($curl);
```

```javascript JavaScript theme={null}
const response = await fetch('https://app.readyforcommerce.com/api/v1/credential', {
  headers: { Authorization: `Bearer ${process.env.RFC_API_KEY}` },
});
console.log(await response.json());
```

The answer starts like this:

```json theme={null}
{
  "org": { "id": "0b9f4c1e-6a2d-4f8e-9c3b-7d1a5e2f8c40", "name": "Acme Outdoor" },
  "type": "api_key",
  "name": "Sales reports",
  "display": "rfc_key_…X9aQ",
  "expiresAt": "2027-11-13T15:04:05.000Z",
  "permissions": ["core.billing.view", "core.jobs.view", "core.org.view"]
}
```

It goes on with `limits`, your key's calls a minute, and `remaining`, the calls it may still make now (see
[Rate limits](https://developers.readyforcommerce.com/rate-limits.md)). Keep `org.id`: it is the `orgId` of every other path.

```bash theme={null}
export RFC_ORG_ID="0b9f4c1e-6a2d-4f8e-9c3b-7d1a5e2f8c40"
```

**2. Read your organization**

[Get the organization](https://developers.readyforcommerce.com/api-reference/core-get-org.md) reads its name, its slug and its currency.

```bash curl theme={null}
curl "https://app.readyforcommerce.com/api/v1/orgs/$RFC_ORG_ID/core/org" \
  --header "Authorization: Bearer $RFC_API_KEY"
```

```python Python theme={null}
import os

import requests

response = requests.get(
    f"https://app.readyforcommerce.com/api/v1/orgs/{os.environ['RFC_ORG_ID']}/core/org",
    headers={"Authorization": f"Bearer {os.environ['RFC_API_KEY']}"},
)
print(response.json())
```

```php PHP theme={null}
<?php
$curl = curl_init('https://app.readyforcommerce.com/api/v1/orgs/' . getenv('RFC_ORG_ID') . '/core/org');
curl_setopt_array($curl, [
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('RFC_API_KEY')],
    CURLOPT_RETURNTRANSFER => true,
]);
echo curl_exec($curl);
```

```javascript JavaScript theme={null}
const response = await fetch(
  `https://app.readyforcommerce.com/api/v1/orgs/${process.env.RFC_ORG_ID}/core/org`,
  { headers: { Authorization: `Bearer ${process.env.RFC_API_KEY}` } },
);
console.log(await response.json());
```

```json theme={null}
{
  "id": "0b9f4c1e-6a2d-4f8e-9c3b-7d1a5e2f8c40",
  "name": "Acme Outdoor",
  "slug": "acme-outdoor",
  "defaultCurrency": "USD"
}
```

**3. Read this month's usage**

[Get this month's usage](https://developers.readyforcommerce.com/api-reference/core-get-billing-usage.md) answers, for each module, how many of each unit
the organization used this month (`count`), its free allowance (`freeAllowance`) and what is left of it (`left`).

```bash curl theme={null}
curl "https://app.readyforcommerce.com/api/v1/orgs/$RFC_ORG_ID/core/billing/usage" \
  --header "Authorization: Bearer $RFC_API_KEY"
```

```python Python theme={null}
import os

import requests

response = requests.get(
    f"https://app.readyforcommerce.com/api/v1/orgs/{os.environ['RFC_ORG_ID']}/core/billing/usage",
    headers={"Authorization": f"Bearer {os.environ['RFC_API_KEY']}"},
)
print(response.json())
```

```php PHP theme={null}
<?php
$curl = curl_init('https://app.readyforcommerce.com/api/v1/orgs/' . getenv('RFC_ORG_ID') . '/core/billing/usage');
curl_setopt_array($curl, [
    CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('RFC_API_KEY')],
    CURLOPT_RETURNTRANSFER => true,
]);
echo curl_exec($curl);
```

```javascript JavaScript theme={null}
const response = await fetch(
  `https://app.readyforcommerce.com/api/v1/orgs/${process.env.RFC_ORG_ID}/core/billing/usage`,
  { headers: { Authorization: `Bearer ${process.env.RFC_API_KEY}` } },
);
console.log(await response.json());
```

> [!TIP]
>
> Your key works. A call that fails answers `application/problem+json` with a `code` that says why:
> see [Errors](https://developers.readyforcommerce.com/errors.md).

## Next steps

> [card] [Errors](https://developers.readyforcommerce.com/errors.md)
>
> The shape of every error, and what to do with the common ones.

> [card] [Pagination](https://developers.readyforcommerce.com/pagination.md)
>
> Read a whole list, a page at a time.

> [card] [Rate limits](https://developers.readyforcommerce.com/rate-limits.md)
>
> The calls a key may make, and how to retry a write safely.

> [card] [API reference](https://developers.readyforcommerce.com/api-reference/introduction.md)
>
> Every operation, with its fields, its errors and examples.


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