# Your First API Call

This guide walks you through making your first authenticated request to the Apiera API.

## Prerequisites

Before you start, make sure you have:

- An Apiera account with API access enabled.
- Your **Client ID**, **Client Secret**, and **Organization ID** from the dashboard (see
[Authentication](/getting-started/authentication)).
- A tool for making HTTP requests (`curl`, Postman, or similar).


## Step 1: Get an access token

Request a token from the authorization server:


```bash
curl -X POST https://auth.apiera.io/oauth/token \
  -H "Content-Type: application/json" \
  -d '{
    "client_id": "YOUR_CLIENT_ID",
    "client_secret": "YOUR_CLIENT_SECRET",
    "audience": "https://api.apiera.io",
    "grant_type": "client_credentials",
    "organization": "org_YOUR_ORG_ID"
  }'
```

Copy the `access_token` from the response:


```json
{
  "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "Bearer",
  "expires_in": 86400
}
```

## Step 2: Make your first request

Use the token to list products in your organization:


```bash
curl https://api.apiera.io/v1/products \
  -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
```

You should receive a paginated response:


```json
{
  "items": [],
  "pagination": {
    "page": 1,
    "size": 25,
    "totalItems": 0,
    "totalPages": 0
  }
}
```

If your organization has no products yet, the `items` array will be empty. That's expected.

## Step 3: Create a product

Create a simple product to confirm write access works:


```bash
curl -X POST https://api.apiera.io/v1/products \
  -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "type": "simple"
  }'
```

The response includes the created product with its UUID:


```json
{
  "uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "type": "simple",
  "status": "draft",
  "createdAt": "2026-03-10T12:00:00Z",
  "updatedAt": "2026-03-10T12:00:00Z"
}
```

## Step 4: Fetch with hydration

Retrieve your product with related data included in a single request:


```bash
curl "https://api.apiera.io/v1/products/a1b2c3d4-e5f6-7890-abcd-ef1234567890?include[]=productAssets&include[]=productCategories&include[]=productTags&expand[productAssets]=true&expand[productCategories]=true&expand[productTags]=true" \
  -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
```

The `include[]` parameter adds arrays of related resource UUIDs to the response. To get the full resource data instead
of just UUIDs, add the corresponding `expand[]` parameter. See [Hydration](/concepts/hydration) for all available
options.

## Correlation IDs

Every response includes an `X-Correlation-ID` header. This is a unique identifier for the request that you can use
when contacting support. You can also pass your own correlation ID in the request header to track requests across
systems:


```bash
curl https://api.apiera.io/v1/products \
  -H "Authorization: Bearer ..." \
  -H "X-Correlation-ID: my-trace-id-123"
```