Sinch Consent API

Consent queries provide a way to retrieve any identities stored within a given consent list. You can also retrieve audit records that provide details for a given identity's journey through [consent management](https://developers.sinch.com/docs/conversation/consent-management/).

Operations 2

GET /v1/projects/{project_id}/apps/{app_id}/consents/{list_type} Get identities from consent list #
GET /v1/projects/{project_id}/apps/{app_id}/consents/identities/{identity} Get audit records from consent lists #

Documentation

📖
Documentation
https://developers.sinch.com/docs/conversation
📖
APIReference
https://developers.sinch.com/docs/conversation/api-reference/template
📖
Documentation
https://developers.sinch.com/docs/est
📖
APIReference
https://developers.sinch.com/docs/est/api-reference/est
📖
Documentation
https://developers.sinch.com/docs/fax
📖
APIReference
https://developers.sinch.com/docs/fax/api-reference/fax
📖
Documentation
https://developers.sinch.com/docs/number-lookup-api-v2
📖
APIReference
https://developers.sinch.com/docs/number-lookup-api-v2/api-reference/number-lookup-v2
📖
Documentation
https://developers.sinch.com/docs/numbers
📖
APIReference
https://developers.sinch.com/docs/numbers/api-reference/imported-hosting
📖
APIReference
https://developers.sinch.com/docs/numbers/api-reference/numbers
📖
APIReference
https://developers.sinch.com/docs/numbers/api-reference/porting
📖
Documentation
https://developers.sinch.com/docs/provisioning-api
📖
APIReference
https://developers.sinch.com/docs/provisioning-api/api-reference/provisioning-api-1
📖
Documentation
https://developers.sinch.com/docs/verification
📖
APIReference
https://developers.sinch.com/docs/verification/api-reference/verification
📖
Documentation
https://developers.sinch.com/docs/voice-2.0
📖
APIReference
https://developers.sinch.com/docs/voice-2.0/api-reference/voice
📖
Documentation
https://developers.sinch.com/docs/10dlc-registration
📖
APIReference
https://developers.sinch.com/docs/10dlc-registration/api-reference/10dlc-registration
📖
Documentation
https://developers.sinch.com/docs/accesskeys
📖
APIReference
https://developers.sinch.com/docs/accesskeys/api-reference/oldaccesskeys
📖
APIReference
https://developers.sinch.com/docs/accesskeys/api-reference/accesskeys
📖
Documentation
https://developers.sinch.com/docs/campaigns
📖
APIReference
https://developers.sinch.com/docs/campaigns/api-reference/campaigns
📖
Documentation
https://developers.sinch.com/docs/chatlayer-analytics
📖
APIReference
https://developers.sinch.com/docs/chatlayer-analytics/api-reference/chatlayer-analytics
📖
Documentation
https://developers.sinch.com/docs/compliance-center
📖
APIReference
https://developers.sinch.com/docs/compliance-center/api-reference/compliance-brands
📖
Documentation
https://developers.sinch.com/docs/subprojects
📖
APIReference
https://developers.sinch.com/docs/subprojects/api-reference/subprojects

Specifications

Schemas & Data

📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-v2-template-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-v2-list-translations-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-v2-list-templates-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-call-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-sip-trunk-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-sip-endpoint-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-ip-range-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-access-control-list-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-number-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-fax-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-service-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-template-by-name-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-update-template-request-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-service-phone-number-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-cover-page-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-number-lookup-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-number-lookup-request-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-hosting-order-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-qualified-number-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-text-enable-numbers-request-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-hosting-order-number-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-imported-number-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-list-imported-numbers-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-active-number-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-rent-any-number-request-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-validate-address-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-number-order-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-create-number-order-request-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-registration-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-order-list-item-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-defaults-configuration-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-pagination-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-voice-configuration-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-order-document-base-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-port-in-order-group-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-whatsapp-account-dto-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-whatsapp-sender-dto-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-whatsapp-template-dto-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-whatsapp-partial-template-dto-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-webhook-webhook-input-dto-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-webhook-update-webhook-input-dto-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-verification-report-request-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-batch-summary-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-session-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-call-request-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-service-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-validate-svaml-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-create-tcr-campaign-request-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-access-key-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-create-access-key-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-list-access-keys-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-create-access-key-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-update-access-key-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-campaign-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-carrier-order-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-note-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-list-campaign-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-campaign-attachment-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-create-campaign-request-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-get-flow-step-details-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-get-conversation-flow-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-funnel-step-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-funnel-step-filter-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-get-intents-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-list-event-definitions-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-brand-order-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-brand-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-attachment-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-import-brand-request-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-create-brand-request-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-callback-config-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-subproject-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/sinch/refs/heads/main/json-schema/sinch-list-subprojects-response-schema.json

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/sinch:sinch-consent-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

sinch-consent-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  description: '# Overview


    Send and receive messages globally over SMS, RCS, WhatsApp, Viber Business, Facebook messenger and other popular channels using the Sinch Conversation API.'
  title: Conversation API | Sinch Consent API
  version: '1.0'
  license:
    name: MIT
    url: https://www.sinch.com/toc
  contact:
    email: support@sinch.com
    name: support at sinch
servers:
- url: https://{region}.conversation.api.sinch.com
  variables:
    region:
      default: us
      enum:
      - us
      - eu
      - br
  description: The {region} variable must be set to us, eu, or br, and it must match the region in which you created your Conversation API app.
security:
- Basic: []
- oAuth2: []
tags:
- description: Consent queries provide a way to retrieve any identities stored within a given consent list. You can also retrieve audit records that provide details for a given identity's journey through consent management.
  name: Consent
  x-displayName: Consents
paths:
  /v1/projects/{project_id}/apps/{app_id}/consents/{list_type}:
    parameters:
    - $ref: '#/components/parameters/project_id'
    - $ref: '#/components/parameters/app_id'
    - $ref: '#/components/parameters/list_type'
    get:
      description: Get all identities contained within a consent list for a given project id, app id, and list type.
      tags:
      - Consent
      summary: Get identities from consent list
      operationId: Consents_GetConsents
      parameters:
      - description: 'Optional. The maximum number of records to fetch. The default is 10

          and the maximum is 50.'
        name: page_size
        in: query
        schema:
          type: integer
          format: int32
      - description: 'Optional. The page number to fetch. Defaults to first page (0). DEPRECATED: please use page_token instead.'
        name: page_number
        deprecated: true
        in: query
        schema:
          type: integer
          format: int32
      - name: page_token
        in: query
        description: 'A page token, received from a previous Get identities from consent list call.

          Provide this to retrieve a subsequent page.'
        schema:
          type: string
      responses:
        '200':
          $ref: '#/components/responses/getIdentitiesFromConsentResponse'
        '400':
          $ref: '#/components/responses/400Error'
        '401':
          $ref: '#/components/responses/401Error'
        '403':
          $ref: '#/components/responses/403Error'
        '404':
          $ref: '#/components/responses/404Error'
        '500':
          $ref: '#/components/responses/500Error'
        '501':
          $ref: '#/components/responses/501Error'
      x-codeSamples:
      - lang: Java
        source: "/**\n * Sinch Java Snippet\n *\n * <p>This snippet is available at https://github.com/sinch/sinch-sdk-java\n *\n * <p>See https://github.com/sinch/sinch-sdk-java/blob/main/examples/snippets/README.md for details\n */\npackage conversation.consents;\n\nimport com.sinch.sdk.SinchClient;\nimport com.sinch.sdk.domains.conversation.api.v1.ConsentsService;\nimport com.sinch.sdk.domains.conversation.models.v1.consents.ConsentsListType;\nimport com.sinch.sdk.domains.conversation.models.v1.consents.response.ConsentsListResponse;\nimport com.sinch.sdk.models.Configuration;\nimport com.sinch.sdk.models.ConversationRegion;\nimport java.util.logging.Logger;\nimport utils.Settings;\n\npublic class ListIdentities {\n\n  private static final Logger LOGGER = Logger.getLogger(ListIdentities.class.getName());\n\n  public static void main(String[] args) {\n\n    String projectId = Settings.getProjectId().orElse(\"MY_PROJECT_ID\");\n    String keyId = Settings.getKeyId().orElse(\"MY_KEY_ID\");\n    String keySecret = Settings.getKeySecret().orElse(\"MY_KEY_SECRET\");\n    String conversationRegion = Settings.getConversationRegion().orElse(\"MY_CONVERSATION_REGION\");\n\n    // The ID of the Conversation App\n    String appId = \"CONVERSATION_APP_ID\";\n\n    // The consent list type to query\n    ConsentsListType listType = ConsentsListType.OPT_OUT_ALL;\n\n    Configuration configuration =\n        Configuration.builder()\n            .setProjectId(projectId)\n            .setKeyId(keyId)\n            .setKeySecret(keySecret)\n            .setConversationRegion(ConversationRegion.from(conversationRegion))\n            .build();\n\n    SinchClient client = new SinchClient(configuration);\n\n    ConsentsService consentsService = client.conversation().v1().consents();\n\n    LOGGER.info(\n        String.format(\"List identities from consent list '%s' for app '%s'\", listType, appId));\n\n    ConsentsListResponse response = consentsService.listIdentities(appId, listType);\n\n    LOGGER.info(\"Response: \");\n\n    response.iterator().forEachRemaining(f -> LOGGER.info(f.toString()));\n  }\n}\n"
      - lang: Node.js
        source: "/**\n * Sinch Node.js Snippet\n * See: https://github.com/sinch/sinch-sdk-node/examples/snippets\n */\nimport { SinchClient } from '@sinch/sdk-core';\nimport * as dotenv from 'dotenv';\ndotenv.config();\n\nasync function main() {\n  const projectId = process.env.SINCH_PROJECT_ID ?? 'MY_PROJECT_ID';\n  const keyId = process.env.SINCH_KEY_ID ?? 'MY_KEY_ID';\n  const keySecret = process.env.SINCH_KEY_SECRET ?? 'MY_KEY_SECRET';\n  const conversationRegion = process.env.SINCH_CONVERSATION_REGION ?? 'MY_CONVERSATION_REGION';\n\n  // The ID of the Conversation App to list the Consent Identities from\n  const appId = 'CONVERSATION_APP_ID';\n\n  const sinch = new SinchClient({ projectId, keyId, keySecret, conversationRegion });\n\n  try {\n    const response = await sinch.conversation.consents.listIdentities({\n      app_id: appId,\n      list_type: 'OPT_OUT_ALL',\n    });\n    if (response.data.length === 0) {\n      console.log('No Consent Identities found.');\n      return;\n    }\n    console.log(`✅ Found ${response.data.length} Consent Identities.`);\n    response.data.forEach((consentIdentity) => {\n      console.log(consentIdentity);\n    });\n  } catch (err) {\n    console.error('❌ Failed to list the Consent Identities:');\n    console.error(err);\n  }\n}\n\nmain();\n"
  /v1/projects/{project_id}/apps/{app_id}/consents/identities/{identity}:
    parameters:
    - $ref: '#/components/parameters/project_id'
    - $ref: '#/components/parameters/app_id'
    - $ref: '#/components/parameters/identity'
    get:
      description: Get all audit records associated with the given identity from the consent lists within the specified project and app.
      tags:
      - Consent
      summary: Get audit records from consent lists
      operationId: Consents_GetConsentsAuditRecords
      responses:
        '200':
          $ref: '#/components/responses/getAuditRecordsFromConsentResponse'
        '400':
          $ref: '#/components/responses/400Error'
        '401':
          $ref: '#/components/responses/401Error'
        '403':
          $ref: '#/components/responses/403Error'
        '404':
          $ref: '#/components/responses/404Error'
        '500':
          $ref: '#/components/responses/500Error'
        '501':
          $ref: '#/components/responses/501Error'
      x-codeSamples:
      - lang: Java
        source: "/**\n * Sinch Java Snippet\n *\n * <p>This snippet is available at https://github.com/sinch/sinch-sdk-java\n *\n * <p>See https://github.com/sinch/sinch-sdk-java/blob/main/examples/snippets/README.md for details\n */\npackage conversation.consents;\n\nimport com.sinch.sdk.SinchClient;\nimport com.sinch.sdk.domains.conversation.api.v1.ConsentsService;\nimport com.sinch.sdk.domains.conversation.models.v1.consents.response.AuditRecordsResponse;\nimport com.sinch.sdk.models.Configuration;\nimport com.sinch.sdk.models.ConversationRegion;\nimport java.util.logging.Logger;\nimport utils.Settings;\n\npublic class ListAuditRecords {\n\n  private static final Logger LOGGER = Logger.getLogger(ListAuditRecords.class.getName());\n\n  public static void main(String[] args) {\n\n    String projectId = Settings.getProjectId().orElse(\"MY_PROJECT_ID\");\n    String keyId = Settings.getKeyId().orElse(\"MY_KEY_ID\");\n    String keySecret = Settings.getKeySecret().orElse(\"MY_KEY_SECRET\");\n    String conversationRegion = Settings.getConversationRegion().orElse(\"MY_CONVERSATION_REGION\");\n\n    // The ID of the Conversation App\n    String appId = \"CONVERSATION_APP_ID\";\n\n    // The identity to retrieve audit records for (e.g. a phone number)\n    String identity = \"MY_IDENTITY\";\n\n    Configuration configuration =\n        Configuration.builder()\n            .setProjectId(projectId)\n            .setKeyId(keyId)\n            .setKeySecret(keySecret)\n            .setConversationRegion(ConversationRegion.from(conversationRegion))\n            .build();\n\n    SinchClient client = new SinchClient(configuration);\n\n    ConsentsService consentsService = client.conversation().v1().consents();\n\n    LOGGER.info(String.format(\"List audit records for identity '%s' in app '%s'\", identity, appId));\n\n    AuditRecordsResponse response = consentsService.listAuditRecords(appId, identity);\n\n    LOGGER.info(\"Response: \" + response);\n  }\n}\n"
      - lang: Node.js
        source: "/**\n * Sinch Node.js Snippet\n * See: https://github.com/sinch/sinch-sdk-node/examples/snippets\n */\nimport { SinchClient } from '@sinch/sdk-core';\nimport * as dotenv from 'dotenv';\ndotenv.config();\n\nasync function main() {\n  const projectId = process.env.SINCH_PROJECT_ID ?? 'MY_PROJECT_ID';\n  const keyId = process.env.SINCH_KEY_ID ?? 'MY_KEY_ID';\n  const keySecret = process.env.SINCH_KEY_SECRET ?? 'MY_KEY_SECRET';\n  const conversationRegion = process.env.SINCH_CONVERSATION_REGION ?? 'MY_CONVERSATION_REGION';\n\n  // The ID of the Conversation App to list the audit records from, for a given identity\n  const appId = 'CONVERSATION_APP_ID';\n  // The phone number of the recipient in E.164 format without the leading '+' (e.g., 46701234567)\n  const recipientPhoneNumber = 'RECIPIENT_PHONE_NUMBER';\n\n  const sinch = new SinchClient({ projectId, keyId, keySecret, conversationRegion });\n\n  try {\n    const response = await sinch.conversation.consents.listAuditRecords({\n      app_id: appId,\n      identity: recipientPhoneNumber,\n    });\n    console.log('✅ Successfully listed the audit records.');\n    console.log(JSON.stringify(response, null, 2));\n  } catch (err) {\n    console.error(`❌ Failed to list the audit records for the identity ${recipientPhoneNumber} in the Conversation App with ID ${appId}:`);\n    console.error(err);\n  }\n}\n\nmain();\n"
components:
  responses:
    403Error:
      description: Correct credentials but you don't have access to the requested resource. See [common error responses](https://developers.sinch.com/docs/conversation/api-reference/#common-error-responses) for more information.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/runtimeError'
          example:
            code: 403
            message: You do not have access to the requested resource.
            status: UNAUTHORIZED
            details: []
    501Error:
      description: Something went wrong on our end, try again with exponential back-off. See [common error responses](https://developers.sinch.com/docs/conversation/api-reference/#common-error-responses) for more information.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/runtimeError'
          example:
            code: 501
            message: There was an internal server error.
            status: INTERNAL_ERROR
            details: []
    getAuditRecordsFromConsentResponse:
      description: A successful response.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GetAuditRecordsFromConsentResponse'
    500Error:
      description: Correct credentials but you don't have access to the requested resource. See [common error responses](https://developers.sinch.com/docs/conversation/api-reference/#common-error-responses) for more information.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/runtimeError'
          example:
            code: 500
            message: There was an internal server error.
            status: INTERNAL_ERROR
            details: []
    404Error:
      description: No information was found. See [common error responses](https://developers.sinch.com/docs/conversation/api-reference/#common-error-responses) for more information.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/runtimeError'
          example:
            code: 404
            message: information not found
            status: NOT_FOUND
            details: []
    400Error:
      description: Malformed request. See [common error responses](https://developers.sinch.com/docs/conversation/api-reference/#common-error-responses) for more information.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/runtimeError'
          example:
            code: 400
            message: Malformed request
            status: INVALID_REQUEST
            details: []
    401Error:
      description: Incorrect credentials. See [common error responses](https://developers.sinch.com/docs/conversation/api-reference/#common-error-responses) for more information.
      content:
        application/json:
          schema:
            type: object
    getIdentitiesFromConsentResponse:
      description: A successful response.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GetIdentitiesFromConsentResponse'
  parameters:
    app_id:
      name: app_id
      description: The unique ID of the app. You can find this on the [Sinch Dashboard](https://dashboard.sinch.com/convapi/apps).
      in: path
      required: true
      schema:
        type: string
    project_id:
      name: project_id
      description: The unique ID of the project. You can find this on the [Sinch Dashboard](https://dashboard.sinch.com/convapi/apps).
      in: path
      required: true
      schema:
        type: string
    list_type:
      name: list_type
      description: The consent list type. One of `OPT_OUT_ALL`, `OPT_OUT_MARKETING`, and or `OPT_OUT_NOTIFICATION`.
      in: path
      required: true
      schema:
        $ref: '#/components/schemas/ConsentsListType'
    identity:
      name: identity
      description: An identity to use on Consent audit records queries.
      in: path
      required: true
      schema:
        type: string
  schemas:
    ConsentsListType:
      type: string
      description: The consent list type. See [consent management](https://developers.sinch.com/docs/conversation/consent-management) page for more information.
      enum:
      - OPT_OUT_ALL
      - OPT_OUT_MARKETING
      - OPT_OUT_NOTIFICATION
      x-enumDescriptions:
        OPT_OUT_ALL: List type that blocks all kinds of messages
        OPT_OUT_MARKETING: List type that blocks only marketing messages
        OPT_OUT_NOTIFICATION: List type that blocks only notification messages
    AuditRecord:
      description: Represents a consent audit record from the Conversation API.
      type: object
      title: AuditRecord
      required:
      - operation
      - origin
      - list_type
      - project_id
      - app_id
      - datetime
      properties:
        origin:
          description: The origin from the opt-out or opt-in. This could be the Batch API or an MO (when matched with an end-user MO).
          type: string
          enum:
          - ORIGIN_API
          - ORIGIN_MO
          x-enumDescriptions:
            ORIGIN_API: The opt-in or opt-out came from the API.
            ORIGIN_MO: The opt-in or optout came from an MO.
        operation:
          description: The operation that the audit record refers to. Can be INSERT, UPDATE or DELETE.
          type: string
          enum:
          - OPERATION_INSERT
          - OPERATION_UPDATE
          - OPERATION_DELETE
          x-enumDescriptions:
            OPERATION_INSERT: The Insert operation
            OPERATION_UPDATE: The Update operation
            OPERATION_DELETE: The Delete operation
        list_type:
          allOf:
          - description: The list type of the consent list the audit record refers to.
          - $ref: '#/components/schemas/ConsentsListType'
        project_id:
          description: The project ID associated with the consent list the audit record refers to.
          type: string
        app_id:
          description: The app ID associated with the consent list the audit record refers to.
          type: string
        datetime:
          description: Datetime of when the consent list audit record happened.
          type: string
          format: date-time
    GetIdentitiesFromConsentResponse:
      type: object
      properties:
        identities:
          type: array
          description: List of identities belonging to a specific project ID, app ID, and list type
          items:
            $ref: '#/components/schemas/Identity'
        next_page_token:
          description: Token for the next page of the search, to be used in the next call.
          type: string
    Identity:
      description: Represents a identity from the Conversation API.
      type: object
      title: Identity
      required:
      - identity
      properties:
        identity:
          description: The identity from Conversation API.
          type: string
    GetAuditRecordsFromConsentResponse:
      type: object
      properties:
        identity:
          $ref: '#/components/schemas/Identity'
        audit_records:
          type: array
          description: List of audit records associated with the given identity
          items:
            $ref: '#/components/schemas/AuditRecord'
    runtimeError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
              format: int32
            details:
              type: array
              items:
                $ref: '#/components/schemas/protobufAny'
            message:
              type: string
            status:
              type: string
    protobufAny:
      type: object
      properties:
        type_url:
          type: string
        value:
          type: string
          format: byte
  securitySchemes:
    Basic:
      type: http
      scheme: basic
      description: For more information about basic authentication, see [Basic Authentication](https://developers.sinch.com/docs/conversation/api-reference/#authentication).
    oAuth2:
      type: oauth2
      description: The user name and password are your client_id and key_secret from the [Access keys sections](https://dashboard.sinch.com/settings/access-keys)
      flows:
        clientCredentials:
          tokenUrl: https://auth.sinch.com/oauth2/token
          scopes: {}
x-explorer-enabled: false
x-samples-languages:
- curl
- java
- csharp
- node
- php
x-readme:
  proxy-enabled: true
  samples-enabled: true