# Company API

> Your company, users, teams and invitations. Every route, its parameters and fields.

Your company, users, teams and invitations. 24 routes; send a bearer token with each (see [Authentication](/api/authentication.md)).

| Route | What it does |
| --- | --- |
| `GET /v1/me` | Who am I |
| `PATCH /v1/me` | Change my name, language, locale or theme |
| `GET /v1/companies` | My companies |
| `POST /v1/companies` | Create a company |
| `POST /v1/me/company` | Switch the active company |
| `GET /v1/invitations` | My pending invitations |
| `POST /v1/invitations` | Invite a person (admins) |
| `POST /v1/invitations/{id}/accept` | Accept an invitation |
| `DELETE /v1/invitations/{id}` | Withdraw an invitation (admins) |
| `GET /v1/users` | The company's users |
| `PATCH /v1/users/{id}` | Change a user's role, admin flag or name, or deactivate them (admins) |
| `GET /v1/company` | The company's details |
| `PATCH /v1/company` | Change the company's details (admins) |
| `GET /v1/company/logo` | The company logo |
| `PUT /v1/company/logo` | Upload the company logo (admins) |
| `DELETE /v1/company/logo` | Remove the company logo (admins) |
| `GET /v1/teams` | The company's teams |
| `POST /v1/teams` | Create a team (admins) |
| `GET /v1/teams/{id}` | A team with its members |
| `PATCH /v1/teams/{id}` | Rename, describe, archive or restore a team (admins) |
| `GET /v1/teams/{id}/members` | A team's members |
| `POST /v1/teams/{id}/members` | Add a member to a team (admins) |
| `PATCH /v1/teams/{id}/members/{userId}` | Mark or unmark a team lead (admins) |
| `DELETE /v1/teams/{id}/members/{userId}` | Remove a member from a team (admins) |

## Who am I

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

### Response 200

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

## Change my name, language, locale or theme

`PATCH https://staging-api.naruskacrm.com/v1/me`

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `display_name` | string |  | 1–200 characters |
| `language` | `en`, `fi` or null |  |  |
| `locale` | string or null |  | at most 35 characters |
| `theme` | `forest`, `midnight-sun`, `ruska`, `polar-night` or null |  |  |

### Response 200

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

## My companies

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

### Response 200

| Field | Type | Always present | Notes |
| --- | --- | --- | --- |
| `data` | array of [CompanySummary](/api/reference/objects.md#companysummary) | yes |  |

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

## Create a company

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

You become its first user and admin, and it becomes your active company: refresh the session to get a token for it.

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `name` | string | yes | 1–200 characters |
| `base_currency` | string | yes |  |
| `country` | string | yes |  |
| `default_language` | `en`, `fi` |  |  |

### Response 201

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

## Switch the active company

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

For the web and mobile apps. Refresh the session afterwards; OAuth connectors keep the company chosen at consent (Review log 13).

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `company_id` | string (uuid) | yes |  |

### Response 200

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

## My pending invitations

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

### Response 200

| Field | Type | Always present | Notes |
| --- | --- | --- | --- |
| `data` | array of [Invitation](/api/reference/objects.md#invitation) | yes |  |

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

## Invite a person (admins)

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

Creates a pending user; the person joins by signing in with that email and accepting. Inviting the email of a withdrawn invitation reopens it. Live people and pending invitations count against the plan's user limit.

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `email` | string | yes | at most 320 characters |
| `display_name` | string | yes | 1–200 characters |
| `role` | `rep`, `manager`, `director` |  |  |
| `is_admin` | boolean |  |  |

### Response 201

Returns: [User](/api/reference/objects.md#user).

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

## Accept an invitation

`POST https://staging-api.naruskacrm.com/v1/invitations/{id}/accept`

### Parameters

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

### Response 200

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

## Withdraw an invitation (admins)

`DELETE https://staging-api.naruskacrm.com/v1/invitations/{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).

## The company's users

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

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `q` | query | string |  | at most 200 characters |
| `kind` | query | `person`, `service` |  |  |
| `include_deactivated` | query | `true`, `false` |  |  |

### Response 200

| Field | Type | Always present | Notes |
| --- | --- | --- | --- |
| `data` | array of [User](/api/reference/objects.md#user) | yes |  |

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

## Change a user's role, admin flag or name, or deactivate them (admins)

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

### Parameters

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

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `display_name` | string |  | 1–200 characters |
| `role` | `rep`, `manager`, `director` |  |  |
| `is_admin` | boolean |  |  |
| `deactivated` | boolean |  |  |

### Response 200

Returns: [User](/api/reference/objects.md#user).

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

## The company's details

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

Name, base currency, language, plan, the quote and case number prefixes and the details shown on quote PDFs.

### Response 200

Returns: [Company](/api/reference/objects.md#company).

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

## Change the company's details (admins)

`PATCH https://staging-api.naruskacrm.com/v1/company`

The quote PDF uses legal_name (else name), business_id, vat_id, the address, email, phone and website; quote_number_prefix and case_number_prefix are shown before quote and case numbers (at most 10 characters each). Empty fields are left out of the PDF.

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `name` | string |  | 1–200 characters |
| `default_language` | `en`, `fi` |  |  |
| `quote_number_prefix` | string |  | at most 10 characters |
| `case_number_prefix` | string |  | at most 10 characters |
| `legal_name` | string or null |  | 1–200 characters |
| `business_id` | string or null |  | 1–50 characters |
| `vat_id` | string or null |  | 1–50 characters |
| `street_address` | string or null |  | 1–200 characters |
| `postal_code` | string or null |  | 1–20 characters |
| `city` | string or null |  | 1–100 characters |
| `email` | string (email) or null |  | at most 254 characters |
| `phone` | string or null |  | 1–50 characters |
| `website` | string or null |  | at most 500 characters |

### Response 200

Returns: [Company](/api/reference/objects.md#company).

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

## The company logo

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

### Response 200

The logo (PNG or JPEG).
Returns `image/png` bytes.

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

## Upload the company logo (admins)

`PUT https://staging-api.naruskacrm.com/v1/company/logo`

The raw PNG or JPEG is the body, with Content-Length: at most 500 KB and 1200 × 400 px. It replaces the previous logo and is shown on quote PDFs. Allowed on every plan; counts in storage.bytes.

### Request body

The body is `application/octet-stream` bytes.

### Response 200

Returns: [Company](/api/reference/objects.md#company).

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

## Remove the company logo (admins)

`DELETE https://staging-api.naruskacrm.com/v1/company/logo`

### Response 204

Done.
No body.

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

## The company's teams

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

Archived teams are left out unless include_archived=true. include=members adds each team's members (people and service accounts, deactivated ones included).

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `include_archived` | query | `true`, `false` |  |  |
| `include` | query | `members` |  |  |

### Response 200

| Field | Type | Always present | Notes |
| --- | --- | --- | --- |
| `data` | array of [Team](/api/reference/objects.md#team) | yes |  |

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

## Create a team (admins)

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

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `name` | string | yes | 1–200 characters |
| `description` | string or null |  | at most 500 characters |

### Response 201

Returns: [Team](/api/reference/objects.md#team).

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

## A team with its members

`GET https://staging-api.naruskacrm.com/v1/teams/{id}`

### Parameters

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

### Response 200

Returns: [Team](/api/reference/objects.md#team).

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

## Rename, describe, archive or restore a team (admins)

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

archived: true archives the team (it can't receive new records); false brings it back.

### Parameters

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

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `name` | string |  | 1–200 characters |
| `description` | string or null |  | at most 500 characters |
| `archived` | boolean |  |  |

### Response 200

Returns: [Team](/api/reference/objects.md#team).

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

## A team's members

`GET https://staging-api.naruskacrm.com/v1/teams/{id}/members`

### Parameters

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

### Response 200

| Field | Type | Always present | Notes |
| --- | --- | --- | --- |
| `data` | array of [TeamMember](/api/reference/objects.md#teammember) | yes |  |

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

## Add a member to a team (admins)

`POST https://staging-api.naruskacrm.com/v1/teams/{id}/members`

### Parameters

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

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `user_id` | string (uuid) | yes |  |
| `is_lead` | boolean |  |  |

### Response 201

Returns: [Team](/api/reference/objects.md#team).

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

## Mark or unmark a team lead (admins)

`PATCH https://staging-api.naruskacrm.com/v1/teams/{id}/members/{userId}`

The lead flag is a label; visibility comes from the manager role and team membership.

### Parameters

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

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `is_lead` | boolean | yes |  |

### Response 200

Returns: [Team](/api/reference/objects.md#team).

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

## Remove a member from a team (admins)

`DELETE https://staging-api.naruskacrm.com/v1/teams/{id}/members/{userId}`

### Parameters

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

### Response 204

Done.
No body.

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

