# Insert consent records

Insert consent records for multiple identifications in a single request. If the request fails, none or only some of the records may be inserted. Retry the batch later to try again.

Endpoint: POST /v1/projects/{project_id}/consents
Version: 1.0
Security: BearerAuth

## Security:

  - `BearerAuth` (unknown)
    http bearer

## Path parameters:

  - `project_id` (string, required)
    The unique ID of the project. You can find this on the [Sinch Dashboard](https://dashboard.sinch.com/convapi/apps).

## Request fields (application/json):

  - `app_id` (string, required)
    The ID of the Conversation API app under which the consent records are to be stored.

  - `consent_records` (array, required)
    A list of consent records to create. Each record must include an `identification` field, which uniquely identifies the subject (e.g., phone number or contact ID), and a `consent_type`.

  - `consent_records.identification` (string, required)
    Unique identifier for the subject of the consent (e.g., phone number, contact ID).

  - `consent_records.consent_type` (string)
    The type of consent being inserted.
    Enum: "OPT_OUT_ALL", "OPT_OUT_NOTIFICATION", "OPT_OUT_MARKETING"

## Request examples:

  - `Insert multiple consents` (unknown)

## Response 200:

  - `200` (unknown)
    OK

## Response 200 fields (application/json):

  - `batch_id` (string)
    The unique ID for the batch of consent records created.

## Response 401:

  - `401` (unknown)
    Invalid credentials

## Response 403:

  - `403` (unknown)
    Permission denied. The specified project may not be allowed to use the batch endpoint.

## Response 403 fields (application/json):

  - `code` (integer)

  - `message` (string)

  - `status` (string)

  - `details` (array)

## Response 500:

  - `500` (unknown)
    Internal error

## Response 500 fields (application/json):

  - `code` (integer)

  - `message` (string)

  - `status` (string)

  - `details` (array)

## Response 403 examples:

  - `Permission denied` (unknown)

## Response 500 examples:

  - `Internal error` (unknown)

