---
title: "Create an integration key"
method: POST
path: "/v1/integrations/keys"
tags: ["Integrations key"]
---

# Create an integration key

`POST /v1/integrations/keys`

## Request

- Base URL: `https://api.cardda.com`
- URL: `https://api.cardda.com/v1/integrations/keys`
- Auth: HTTP bearer

Creates an integration key against a service (`key_service_id`), owned by the calling
user and enabled on creation.

The required secret depends on the service's auth method: `token`-based services
require `token`; `password`-based services require `password` and `identifier`. The
`auth_method` and `identifier_type` are copied from the service.

## Parameters

- `#/paths/~1v1~1bills/get/parameters/0` (unresolved $ref)

## Request body

- IntegrationsKeyCreate: Body to create an integration key. The required secret depends on the auth method of the referenced key service: `token`-based services require `token`; `password`-based services require `password` and `identifier`. The key is created enabled and owned by the calling user; `auth_method` and `identifier_type` are copied from the key service.
  - `key_service_id` string, required: Id of the integration service (Integrations::KeyService) to authenticate against.
  - `token` string: API token. Required when the key service's auth method is `token`.
  - `password` string: Account password. Required when the key service's auth method is `password`.
  - `identifier` string: Account identifier (e.g. RUT). Required when the auth method is `password`.

## Response `201`

The created integration key.

- IntegrationsKey: A stored credential ("key") for a third-party integration service, owned by the current user. The secret fields `password` and `token` are never returned (omitted from index/show responses).
  - `id` string, uuid, required
  - `status` string, required
  - `enabled` boolean, nullable
  - `auth_method` 'token' | 'password', required: Authentication method, inherited from the key service.
  - `identifier` string, nullable: The account identifier (e.g. RUT/username) for password-based services.
  - `identifier_type` string, nullable
  - `key_service_id` string, required: Id of the integration service this key authenticates against.
  - `user_id` string, required: Owner of the key.
  - `company_ids` string[]: Ids of the companies managed with this key, added via serializer method.
  - `meta` object, nullable
  - `created_at` string, date-time
  - `updated_at` string, date-time

## Other responses

- `401`: Unauthorized - missing or invalid authentication token.
- `404`: The referenced key service was not found.
- `422`: Validation failed (e.g. a required secret for the service's auth method is missing).

---

[API](https://skmtc.dev/cardda/apis/finance-api.md) - [All operations](https://skmtc.dev/cardda/apis/finance-api/llms.txt) - [OpenAPI document](https://skmtc.dev/cardda/apis/finance-api/revisions/59752c65ea74?raw)
