# Affiliations API

> Links between contacts and accounts. Every route, its parameters and fields.

Links between contacts and accounts. 4 routes; send a bearer token with each (see [Authentication](/api/authentication.md)).

| Route | What it does |
| --- | --- |
| `GET /v1/affiliations` | List affiliations |
| `POST /v1/affiliations` | Link a contact to an account |
| `PATCH /v1/affiliations/{id}` | Update an affiliation |
| `DELETE /v1/affiliations/{id}` | Remove an affiliation |

## List affiliations

`GET https://staging-api.naruskacrm.com/v1/affiliations`

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `limit` | query | integer |  | 1–200, default `50` |
| `cursor` | query | string |  | next_cursor of the previous page. 1–400 characters |
| `contact_id` | query | string (uuid) |  |  |
| `account_id` | query | string (uuid) |  |  |
| `current` | query | `true`, `false` |  |  |

### Response 200

| Field | Type | Always present | Notes |
| --- | --- | --- | --- |
| `data` | array of [Affiliation](/api/reference/objects.md#affiliation) | yes |  |
| `next_cursor` | string or null | yes |  |

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Link a contact to an account

`POST https://staging-api.naruskacrm.com/v1/affiliations`

start_date is required when the contact already has an affiliation with that account (02 Review log 17); a new job title at the same account ends the old affiliation first.

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `contact_id` | string (uuid) | yes |  |
| `account_id` | string (uuid) | yes |  |
| `job_title` | string or null |  | at most 200 characters |
| `start_date` | string (date) or null |  |  |
| `end_date` | string (date) or null |  |  |
| `is_primary` | boolean |  |  |

### Response 201

Returns: [Affiliation](/api/reference/objects.md#affiliation).

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Update an affiliation

`PATCH https://staging-api.naruskacrm.com/v1/affiliations/{id}`

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `job_title` | string or null |  | at most 200 characters |
| `start_date` | string (date) or null |  |  |
| `end_date` | string (date) or null |  |  |
| `is_primary` | boolean |  |  |

### Response 200

Returns: [Affiliation](/api/reference/objects.md#affiliation).

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Remove an affiliation

`DELETE https://staging-api.naruskacrm.com/v1/affiliations/{id}`

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Response 204

Done.
No body.

Errors are problem details with a stable `code`: see [Errors](/errors.md).

