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

# JSON:API

> How Membership.io shapes requests, responses, errors, and resource types.

Most Membership.io endpoints return JSON:API-style documents.

Use this request header:

```http theme={null}
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
```

`application/json` is also accepted by the backend for compatibility, but `application/vnd.api+json` is the canonical media type.

## Resource response

A single resource response has `data.id`, `data.type`, and `data.attributes`.

```json theme={null}
{
  "data": {
    "id": "0197...",
    "type": "hubs",
    "attributes": {
      "title": "Member Academy",
      "slug": "member-academy",
      "created_at": "2026-06-08T12:00:00Z"
    }
  }
}
```

## List response

A list response returns `data` as an array. Paginated endpoints also include links and metadata.

```json theme={null}
{
  "data": [],
  "links": {
    "self": "/api/v1/teams/team_123/contacts?page[size]=20",
    "next": "/api/v1/teams/team_123/contacts?page[size]=20&page[after]=cursor"
  },
  "meta": {
    "has_more": true
  }
}
```

## Write request

Many newer write endpoints use a JSON:API envelope:

```json theme={null}
{
  "data": {
    "type": "contacts",
    "attributes": {
      "email": "member@example.com",
      "first_name": "Sam"
    }
  }
}
```

<Warning>
  Some alpha endpoints still accept flat request bodies or return flat token bodies. Check the generated OpenAPI page for the exact endpoint before building a client.
</Warning>

## Errors

Errors return an `errors` array. Each error has an HTTP status string, title, detail, optional code, and optional source pointer.

```json theme={null}
{
  "errors": [
    {
      "status": "422",
      "code": "validation_error",
      "title": "Validation Error",
      "detail": "Field required",
      "source": {
        "pointer": "/data/attributes/email"
      },
      "meta": {
        "request_id": "req_..."
      }
    }
  ]
}
```
