openapi: 3.0.3
info:
  title: MasConsents API
  description: >-
    This API provides the necessary functionality to be able to give E2E
    coverage to the entire life-cycle of user's commercial consents.


    This API provides the necessary functionality to be able to securize custom
    information into a jwt token.
  version: v2
  contact:
    name: administrator
    email: masdoc.squad@masmovil.com
servers:
  - url: 'https://consents.masstack.com/v2/'
    description: production
  - url: 'https://consents.sta.masstack.com/v2/'
    description: staging
tags:
  - name: Customer Consents
    description: Access to user consents
  - name: Configuration
    description: Access to consents configuration
  - name: Securize
    description: Access to securize data
paths:
  '/orgs/{org_id}/consents':
    post:
      tags:
        - Configuration
      summary: Create a new consent definition
      description: Creates a new consent definition for a specific organization.
      operationId: createConsent
      parameters:
        - $ref: '#/components/parameters/OrgIdPathParam'
      requestBody:
        description: Consent definition
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateConsentRequest'
            example:
              id: CONSENT01
              type: OPT_IN
              expiration_policy:
                duration: P90D
              consent:
                - language: es
                  text: Spanish text of the consent
                  description: Spanish description of the consent
                  short_text: Spanish short text of the consent
                - language: en
                  text: English text of the consent
                  description: English description of the consent
                  short_text: English short text of the consent
      responses:
        '201':
          description: Consent created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SavedConsentResponse'
              example:
                id: C01
                languages:
                  - es
                  - ca
                  - eu
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          $ref: '#/components/responses/Conflict'
        '500':
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
        - Configuration
      summary: Get available definitions consents configured for tenant
      description: >-
        Retrieves a list of all available consents for a specific organization
        with pagination and filtering options.
      operationId: getConsentsDefinitions
      parameters:
        - $ref: '#/components/parameters/OrgIdPathParam'
        - $ref: '#/components/parameters/PaginationPageParam'
        - $ref: '#/components/parameters/PaginationPageSizeParam'
        - name: choice_type
          in: query
          required: false
          description: >-
            Filter by consent choice type (OPT_IN or OPT_OUT_NEGATIVE or
            OPT_OUT_POSITIVE)
          schema:
            $ref: '#/components/schemas/ConsentType'
          example: OPT_IN
        - name: consent_id
          in: query
          required: false
          description: Filter by consent identifier
          schema:
            $ref: '#/components/schemas/ConsentId'
          example: C01
      responses:
        '200':
          description: List of available consents definitions retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetConsentsDefinitionsResponse'
              example:
                consents:
                  - id: DATA_PROCESSING
                    choice_type: OPT_IN
                    consent:
                      - language: es
                        text: >-
                          Información comercial de servicios nuestros distintos
                          a los contratados o de otras empresas del Grupo
                        description: >-
                          Pertenecemos a un Grupo de empresas que prestan
                          productos o servicios de diversa naturaleza, tales
                          como energía, telecomunicaciones, tecnológicos,
                          servicios y equipos para el hogar, financieros o
                          servicios de valor añadido relacionados, por ejemplo,
                          con la salud o seguros o autoconsumo, habitualmente
                          con descuentos o condiciones especiales para clientes
                          del Grupo.
                        short_text: Información de otros servicios contratados
                    subject: john@masmovil.com
                    creation_date: '2023-12-15T08:23:13.000Z'
                    expiration_policy:
                      duration: P90D
                  - id: THIRD_PARTY
                    choice_type: OPT_IN
                    consent:
                      - language: es
                        text: >-
                          Información comercial de productos y servicios de
                          terceros
                        description: >-
                          Podemos llegar a acuerdos comerciales con terceros
                          para ofrecer a nuestros clientes sus productos o
                          servicios, habitualmente, con condiciones especiales.
                        short_text: Información de productos de terceros
                    subject: alice@masmovil.com
                    creation_date: '2023-12-14T15:42:31.000Z'
                    expiration_policy: null
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
  '/orgs/{org_id}/consents/customers':
    get:
      tags:
        - Configuration
      summary: Get tenant consents of users with customer user type
      description: Get tenant consents for customers users
      operationId: getTenantConsentsByUserType
      parameters:
        - $ref: '#/components/parameters/AcceptLanguageHeaderParam'
        - $ref: '#/components/parameters/OrgIdPathParam'
        - $ref: '#/components/parameters/XSectorHeaderParam'
        - $ref: '#/components/parameters/XSegmentHeaderParam'
        - $ref: '#/components/parameters/ViewQueryParam'
        - $ref: '#/components/parameters/DisplayFormatQueryParam'
      responses:
        '200':
          description: Expected response for a non existing user consent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetConsentsResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
  '/orgs/{org_id}/consents/{consent_id}':
    patch:
      tags:
        - Configuration
      summary: Update an existing consent definition
      description: Updates an existing consent definition for a specific organization.
      operationId: updateConsent
      parameters:
        - $ref: '#/components/parameters/OrgIdPathParam'
        - $ref: '#/components/parameters/ConsentIdPathParam'
      requestBody:
        description: Consent definition update
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateConsentRequest'
      responses:
        '200':
          description: Consent updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SavedConsentResponse'
              example:
                id: C01
                locales:
                  - es
                  - ca
                  - eu
                  - ga
                  - en
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
  '/orgs/{org_id}/consents/tree':
    post:
      tags:
        - Configuration
      summary: Create a new consent tree for a tenant in a specific user segment
      description: >-
        Creates a new consent tree definition for a specific organization and
        user's segment.
      operationId: createConsentTree
      parameters:
        - $ref: '#/components/parameters/OrgIdPathParam'
        - $ref: '#/components/parameters/XSegmentHeaderParamRequired'
      requestBody:
        description: Consent tree definition
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateConsentTreeRequest'
            example:
              description: Telco Customers Configuration
              default_language: es
              allowed_languages:
                - es
                - eu
                - en
                - ca
              consents_order:
                - C01
                - C02
                - C03
                - C04
                - C05
                - C06
                - C07
              priority_consent_ids:
                - C01
                - C02
                - C03
              views:
                - view: MANDATORY
                  consents:
                    - C01
                    - C02
                    - C03
                - view: PORTFOLIO
                  consents:
                    - C01
                    - C03
                    - C02
                    - C04
                    - C05
                    - C06
              dependencies:
                - father: C01
                  child:
                    - C02
                    - C03
                    - C04
              channels:
                - crm
                - agents
                - web
                - whatsapp
                - landing_web
                - landing_mobile
              users_type: customers
      responses:
        '204':
          description: Consent tree created successfully (no content)
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalServerError'
    put:
      tags:
        - Configuration
      summary: Update an existing consent tree for a tenant and user segment
      description: >-
        Updates an existing consent tree definition for a specific organization,
        user's segment, and user type. Requires ETag header for optimistic
        concurrency control.
      operationId: updateConsentTree
      parameters:
        - $ref: '#/components/parameters/OrgIdPathParam'
        - $ref: '#/components/parameters/XSegmentHeaderParamRequired'
        - $ref: '#/components/parameters/ETagHeaderParam'
      requestBody:
        description: Consent tree definition update
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateConsentTreeRequest'
            example:
              description: Updated Telco Configuration
              default_language: es
              allowed_languages:
                - es
                - eu
                - en
                - ca
              consents_order:
                - C01
                - C02
                - C03
                - C04
                - C05
                - C06
              priority_consent_ids:
                - C01
                - C02
              change_log: Removed C07 consent
              views:
                - view: MANDATORY
                  consents:
                    - C01
                    - C02
                    - C03
                - view: PORTFOLIO
                  consents:
                    - C01
                    - C02
                    - C03
                    - C04
                    - C05
                    - C06
              dependencies:
                - father: C01
                  child:
                    - C02
                    - C03
                    - C04
              channels:
                - crm
                - agents
                - web
                - whatsapp
                - landing
              users_type: customers
      responses:
        '204':
          description: Consent tree updated successfully (no content)
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
        - Configuration
      summary: Get consent configuration trees for a tenant
      description: >-
        Retrieves all consent configuration trees for a specific tenant,
        filtered by segment and user type
      operationId: getConsentsTrees
      parameters:
        - $ref: '#/components/parameters/OrgIdPathParam'
        - $ref: '#/components/parameters/XSegmentHeaderParam'
        - $ref: '#/components/parameters/UsersTypeParam'
      responses:
        '200':
          description: Consent configuration trees retrieved successfully
          headers:
            ETag:
              description: >-
                Comma-separated list of transaction ids necessary to modify any
                tree returned in this read operation
              schema:
                type: string
              example: >-
                548d1e9f-159c-4223-a1fb-9c7d2a0da142,5c20565c-d16e-4b32-8ba7-519f909402b3
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetConsentTreesResponse'
              example:
                trees:
                  - segment: telco
                    users_type: customers
                    description: Default Telco Configuration
                    default_language: es
                    allowed_languages:
                      - es
                      - eu
                      - en
                      - ca
                    consents_order:
                      - C01
                      - C02
                      - C03
                      - C04
                      - C05
                      - C06
                      - C07
                    priority_consent_ids:
                      - data_processing
                      - c01
                      - c04
                      - c10
                    views:
                      - view: MANDATORY
                        consents:
                          - C01
                          - C02
                          - C03
                      - view: PORTFOLIO
                        consents:
                          - C01
                          - C02
                          - C03
                          - C04
                          - C05
                          - C06
                    dependencies:
                      - father: C01
                        child:
                          - C02
                          - C03
                          - C04
                    channels:
                      - channel_1
                      - channel_2
                      - web
                      - movile
                    creation_subject: john@tenant.com
                    creation_date: '2024-02-01T03:00:00.000Z'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
  '/orgs/{org_id}/customers/{customer_id}/consents':
    delete:
      tags:
        - Customer Consents
      summary: Delete user consents by sector
      description: Delete user consents by sector
      operationId: deleteUserConsents
      parameters:
        - $ref: '#/components/parameters/OrgIdPathParam'
        - $ref: '#/components/parameters/XSectorHeaderParam'
        - $ref: '#/components/parameters/XSegmentHeaderParam'
        - $ref: '#/components/parameters/CustomerIdPathParam'
      responses:
        '204':
          description: Consents deleted successfully
          headers:
            x-key:
              description: Allow operation key
              schema:
                type: string
                example: >-
                  6b9c495a512cb4a7132a5afdd9f295f73dcfae7d70cd1aadc917625d392f8523
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
        - Customer Consents
      summary: Get user consents by CustomerId
      description: >-
        When the user queried is not present in the system, returns the
        mandatory statements consent tree. When the user is present, returns all
        the statements consent tree, and the current user consent metadata
      operationId: getConsentsByCustomerId
      parameters:
        - $ref: '#/components/parameters/AcceptLanguageHeaderParam'
        - $ref: '#/components/parameters/OrgIdPathParam'
        - $ref: '#/components/parameters/XSectorHeaderParam'
        - $ref: '#/components/parameters/XSegmentHeaderParam'
        - $ref: '#/components/parameters/CustomerIdPathParam'
        - $ref: '#/components/parameters/ViewQueryParam'
        - $ref: '#/components/parameters/DisplayFormatQueryParam'
        - $ref: '#/components/parameters/ConsentIdsQueryParam'
        - name: choice
          in: query
          required: false
          description: >-
            Filter consents to be shown by existing choice. For example, if it
            is PENDING, only consents with choice in PENDING state will be
            showed. Can be combined together.

            Allowed values: PENDING, REJECTED, ACCEPTED
          schema:
            type: string
          example: choice=PENDING
      responses:
        '200':
          description: Expected response for a non existing user consent
          headers:
            x-key:
              description: >-
                Allow operation key, it must be passed in consequent
                modification requests. This key can not be manipulated and
                should be sent as is received.
              schema:
                type: string
                example: >-
                  6b9c495a512cb4a7132a5afdd9f295f73dcfae7d70cd1aadc917625d392f8523
          content:
            application/json:
              example:
                locale: es_ES
                statements:
                  - id: C01
                    text: >-
                      Información comercial de productos y servicios de nuestro
                      Grupo de empresas
                    choice: 1
                    description: >-
                      Pertenecemos a un Grupo de empresas que prestan productos
                      y servicios de diversa naturaleza, tales como energía o
                      servicios de valor añadido relacionados, por ejemplo, con
                      la salud o seguros, de los que nos gustaría poder
                      informarte.
                    choice_type: OPT_IN
                    read_only: false
                    child_statements: []
                  - id: C02
                    text: Información comercial de productos y servicios de terceros
                    choice: 1
                    description: >-
                      Podemos llegar a acuerdos comerciales con terceros para
                      ofrecer a nuestros clientes sus productos o servicios
                      (tales como televisión, tecnología o seguros),
                      habitualmente, con condiciones especiales. No te
                      preocupes, no cedemos tus datos a estos terceros.
                    choice_type: OPT_IN
                    read_only: false
                    child_statements: []
                  - id: C03
                    text: >-
                      Información comercial, en base a mi perfil, adaptada a mis
                      intereses y preferencias
                    choice: 1
                    description: ''
                    choice_type: OPT_IN
                    read_only: false
                    child_statements: []
              schema:
                $ref: '#/components/schemas/GetConsentsResponse'
        '202':
          description: Expected response when consent's user exists
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetConsentsResponse'
              example:
                locale: es_ES
                statements:
                  - id: C01
                    text: >-
                      Información comercial de productos y servicios de nuestro
                      Grupo de empresas
                    choice: 1
                    description: >-
                      Pertenecemos a un Grupo de empresas que prestan productos
                      y servicios de diversa naturaleza, tales como energía o
                      servicios de valor añadido relacionados, por ejemplo, con
                      la salud o seguros, de los que nos gustaría poder
                      informarte.
                    choice_type: OPT_IN
                    read_only: false
                    child_statements: []
                  - id: C02
                    text: Información comercial de productos y servicios de terceros
                    choice: 1
                    description: >-
                      Podemos llegar a acuerdos comerciales con terceros para
                      ofrecer a nuestros clientes sus productos o servicios
                      (tales como televisión, tecnología o seguros),
                      habitualmente, con condiciones especiales. No te
                      preocupes, no cedemos tus datos a estos terceros.
                    choice_type: OPT_IN
                    read_only: false
                    child_statements: []
                  - id: C03
                    text: >-
                      Información comercial, en base a mi perfil, adaptada a mis
                      intereses y preferencias
                    choice: 1
                    description: ''
                    choice_type: OPT_IN
                    read_only: false
                    child_statements: []
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
    post:
      tags:
        - Customer Consents
      summary: Post user consents selections by customer_id
      description: >-
        Creates or update a consent's user in the system with an array of
        selections and its metadata
      operationId: saveConsentsByCustomerId
      parameters:
        - $ref: '#/components/parameters/XKeyHeaderParam'
        - $ref: '#/components/parameters/AcceptLanguageHeaderParam'
        - $ref: '#/components/parameters/OrgIdPathParam'
        - $ref: '#/components/parameters/XSectorHeaderParam'
        - $ref: '#/components/parameters/XSegmentHeaderParam'
        - $ref: '#/components/parameters/CustomerIdPathParam'
      requestBody:
        description: Consent's user information and other metadata
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostConsentsCustomerRequest'
            example:
              actor_id: YC004315
              selections:
                - id: C01
                  choice: 0
                - id: C02
                  choice: 0
                - id: C03
                  choice: 2
              ip: 84.44.81.103
              sell_channel: eshop
              trace_id: 12C148A
              capture_date: '2021-05-21T17:32:28Z'
      responses:
        '201':
          description: user consents created/updated. Expected response for a valid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostConsentsResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
  '/orgs/{org_id}/customers/{customer_id}':
    get:
      tags:
        - Customer Consents
      summary: Get user consents metadata by Customer Id
      description: >-
        When the user queried is not present in the system, returns 404. When
        the user is present, returns user consent metadata
      operationId: getCustomerMetadataByCustomerId
      parameters:
        - $ref: '#/components/parameters/OrgIdPathParam'
        - $ref: '#/components/parameters/XSectorHeaderParam'
        - $ref: '#/components/parameters/XSegmentHeaderParam'
        - name: customer_id
          in: path
          required: true
          description: The customer identifier at CRM
          example: '143589532625'
          schema:
            type: string
      responses:
        '200':
          description: Expected response for a existing consent user
          content:
            application/json:
              example:
                customer_id: '143589532625'
                impact: true
              schema:
                $ref: '#/components/schemas/GetUserMetadataResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
    patch:
      tags:
        - Customer Consents
      summary: Reassociate customer identifier
      description: >-
        Replaces a customer's legacy CRM identifier with their new MasStack
        identifier (MCONS-34).

        The customer's full entity is reloaded with the active published consent
        tree at execution

        time, applying standard domain logic including possible parent-child
        recalculation if the

        tree has changed since the last save. Emits a standard UPDATED event
        with the new customer

        identifier and the immutable internal userId.


        Fields set automatically — NOT accepted in the request body:

        - ip: extracted from the HTTP request

        - sell_channel: inherited from the existing customer record

        - trace_id: fixed to "update_customer_id"

        - capture_date: system timestamp at execution time
      operationId: updateCustomerId
      parameters:
        - $ref: '#/components/parameters/OrgIdPathParam'
        - $ref: '#/components/parameters/CustomerIdPathParam'
        - $ref: '#/components/parameters/XSegmentHeaderParamRequired'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCustomerIdRequest'
            example:
              new_customer_id: masstack-uuid-abc456
              actor_id: rfm-migration-service
      responses:
        '200':
          description: Customer identifier reassociated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateCustomerIdResponse'
              example:
                customer_id: masstack-uuid-abc456
                selections:
                  - id: C01
                    choice: ACCEPTED
                  - id: C03
                    choice: REJECTED
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '500':
          $ref: '#/components/responses/InternalServerError'
  '/orgs/{org_id}/customers/{customer_id}/consents/import':
    post:
      tags:
        - Customer Consents
      summary: Import customer consents from other system
      description: >-
        Creates a consent record for a customer that does not yet exist in
        MasConsents (MCONS-36).

        Intended for migration flows (e.g. RFM brand onboarding) where consents
        must be imported

        from a other system without running the standard consent capture flow.


        Key differences from the standard save endpoint:

        - No x-key header required.

        - Parent-child inheritance rules and selection propagation are NOT
        applied.

        - Consent IDs in selections that are not present in the active published
        tree are silently ignored (not rejected).

        - Selections with choice PENDING (1) are silently filtered out and not
        stored.

        - ip defaults to "0.0.0.0" if not provided.

        - capture_date defaults to the system timestamp if not provided.


        Emits a standard CREATED event on success.
      operationId: importCustomerConsents
      parameters:
        - $ref: '#/components/parameters/OrgIdPathParam'
        - $ref: '#/components/parameters/CustomerIdPathParam'
        - $ref: '#/components/parameters/XSegmentHeaderParamRequired'
        - $ref: '#/components/parameters/AcceptLanguageHeaderParam'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImportCustomerConsentsRequest'
            example:
              actor_id: rfm-migration-service
              selections:
                - id: C01
                  choice: 0
                - id: C03
                  choice: 2
              capture_date: '2026-03-18T09:00:00Z'
              ip: 84.44.81.103
              trace_id: RFM-RCABLE-BATCH-001
              sell_channel: crm
      responses:
        '201':
          description: Customer consents imported successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImportConsentsResponse'
              example:
                customer_id: d290f1ee-6c54-4b01-90e6-d701748f0851
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          $ref: '#/components/responses/Conflict'
        '500':
          $ref: '#/components/responses/InternalServerError'
  '/orgs/{org_id}/consents/tree/history':
    get:
      tags:
        - Configuration
      operationId: getConsentsTreesHistory
      summary: Get archived consent tree history for a tenant and segment
      description: >-
        Retrieves the historical versions of consent tree configurations for a
        specific organization and segment, ordered chronologically in descending
        order
      parameters:
        - $ref: '#/components/parameters/OrgIdPathParam'
        - $ref: '#/components/parameters/XSegmentHeaderParamRequired'
        - $ref: '#/components/parameters/UsersTypeParam'
        - $ref: '#/components/parameters/PaginationPageParam'
        - $ref: '#/components/parameters/PaginationPageSizeParam'
      responses:
        '200':
          description: Consent tree history retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetConsentTreeHistoryResponse'
              example:
                - version: 08ad0cd1-2a95-40b2-ab05-cf2c0bb33114
                  creation_date: '2025-07-01T11:00:00Z'
                  audit_info:
                    audience: masstack.auth.masmovil.com
                    subject: john@masstack.com
                    change_log: Añadido consentimiento C11 a la vista PORTFOLIO_OFFERS.
                  segment: telco
                  users_type: customers
                  description: Árbol de Consentimientos Telco Clientes V2
                  default_language: es
                  allowed_languages:
                    - es
                    - en
                    - gl
                    - ca
                    - eu
                  consents_order:
                    - C03
                    - C04
                    - C01
                    - C02
                    - C11
                  priority_consent_ids:
                    - C03
                    - C01
                  views:
                    - view: MANDATORY
                      consents:
                        - C03
                        - C01
                    - view: PORTFOLIO_OFFERS
                      consents:
                        - C01
                        - C02
                        - C11
                  dependencies:
                    - father: C03
                      child:
                        - C04
                  captured_channels:
                    - web
                    - app
                - version: 0dbb2658-185d-4eca-8f95-0d2b3d0d1ba7
                  creation_date: '2025-02-10T15:00:00Z'
                  audit_info:
                    audience: masstack.auth.masmovil.com
                    subject: john@masstack.com
                    change_log: Versión inicial del árbol para clientes telco.
                  segment: telco
                  users_type: customers
                  description: Árbol de Consentimientos Telco Clientes V1
                  default_language: es
                  allowed_languages:
                    - es
                    - en
                  consents_order:
                    - C03
                    - C04
                    - C01
                    - C02
                  priority_consent_ids:
                    - C03
                    - C01
                  views:
                    - view: MANDATORY
                      consents:
                        - C03
                        - C01
                    - view: PORTFOLIO_OFFERS
                      consents:
                        - C01
                        - C02
                  dependencies:
                    - father: C03
                      child:
                        - C04
                  captured_channels:
                    - web
                    - app
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalServerError'
  '/orgs/{org_id}/consents/{consent_id}/history':
    get:
      tags:
        - Configuration
      summary: Get available historical definitions consents configured for tenant
      description: >-
        Retrieves a list of all historical consents definitions for a specific
        organization.
      operationId: getConsentsDefinitionsHistory
      parameters:
        - $ref: '#/components/parameters/OrgIdPathParam'
        - $ref: '#/components/parameters/ConsentIdPathParam'
        - $ref: '#/components/parameters/PaginationPageParam'
        - $ref: '#/components/parameters/PaginationPageSizeParam'
      responses:
        '200':
          description: List of historical consents definitions retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetConsentsDefinitionsHistoryResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalServerError'
  '/orgs/{org_id}/securize':
    post:
      tags:
        - Securize
      summary: Securize data info into an authn jwt
      description: >-
        Creates or update a consent's user in the system with an array of
        selections and its metadata
      operationId: securize
      parameters:
        - name: org_id
          in: path
          required: true
          description: >-
            The string id related with one of Grupo Masmovil
            tenants/organizations
          schema:
            type: string
          example: masmovil
      requestBody:
        description: Custom data to securize
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SecurizeRequestBody'
      responses:
        '201':
          description: Success response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SecurizeResponse'
components:
  schemas:
    ConsentId:
      type: string
      maxLength: 200
      description: >-
        Consent definition unique identifier (normalized to uppercase without
        spaces and special characters)
      example: C01
    ConsentType:
      type: string
      description: |-
        Consent statement choice type list:
          * `OPT_IN` - Text written in affirmative. May be in pending state
          * `OPT_OUT_NEGATIVE` - Text written in negative. It cannot be in pending state and must be represented with a checkbox
          * `OPT_OUT_POSITIVE` - Text written in affirmative. It cannot be in pending state and must be represented with a checkbox
      example: OPT_IN
    ConsentChoice:
      type: integer
      description: |-
        Consent statement choice list:
          * `0` - Consent accepted
          * `1` - Consent choice unknown
          * `2` - Consent rejected
    ConsentText:
      type: string
      maxLength: 250
      description: Full text of the consent
      example: >-
        Información comercial de servicios nuestros distintos a los contratados
        o de otras empresas del Grupo
    ConsentDescription:
      type: string
      maxLength: 800
      description: Detailed description of the consent
      example: >-
        Pertenecemos a un Grupo de empresas que prestan productos o servicios de
        diversa naturaleza, tales como energía, telecomunicaciones,
        tecnológicos, servicios y equipos para el hogar, financieros o servicios
        de valor añadido relacionados, por ejemplo, con la salud o seguros o
        autoconsumo, habitualmente con descuentos o condiciones especiales para
        clientes del Grupo.
    Language:
      type: string
      description: >-
        Language in locale in RFC 5646 format (defined in RFC 5646, which rely
        on the ISO 639). Ex: es, ca, eu, en, fr
      example: es
    UserSegment:
      description: |-
        Regulated sector where user belongs to.
        Allowed values: telco, energy
      type: string
    UserType:
      type: string
      description: Type of users the consent tree applies to
      example: 'customers, leads'
    SellChannel:
      type: string
      description: |-
        Starting point of the user consent acquisition
        Sell channel list:
         * `app` - App portfolio client
         * `appPopup` - App portfolio client popup
         * `ecare` - Private client area
         * `ecarePopup` - Private client area popup
         * `eshop` - Online web store acquisition client
         * `lpemail` - Email campaign landing page
         * `lpsms` - Sms campaign landing page
         * `mycrm` - Post sales portal, non presential phone sale
         * `mycrmPopup` - Post sales portal, non presential phone sales for portfolio clients
         * `myventa` - Sales portal, non presential phone sale
         * `pos` - Presential sale, seles portal in store
         * `renuevo` - Existing client, hiring another terminal
         * `televenta` - Sales portal, non presential phone sale
         * `topUps` - Presential sale, prepaid recharge machine in store
         * `vista` - CRM postsale
         * `vistaPopup` - CRM popup postsale
         * `webdealer` - Sales portal, presential, sale in store
      example: ecare
    ConfigurationTreeDescription:
      type: string
      maxLength: 200
      description: Description of the consent tree
      example: Default Telco Configuration
    EmailSubject:
      type: string
      description: Email or identifier of the user who created/updated the resource
      example: john@company.com
    DateTimeProperty:
      type: string
      format: date-time
      description: Date and time in ISO format
      example: '2023-12-15T08:23:13.000Z'
    IpAddressProperty:
      type: string
      example: 84.44.81.103
      description: >-
        IP address of the actor who modifies the user consents

        When the actor is, directly, the client who modifies their consents, it
        is important that ip is client ip address and not any kind of middleware
        system ip
    TraceIdProperty:
      type: string
      example: 12C148A
      description: Trazability info
    ActorIdProperty:
      type: string
      example: YC004315
      description: Information about what agent/system/user is setting consents
    LocaleProperty:
      type: string
      description: >-
        Locale. If text is not found, locale will be the organization default
        locale
      example: es_ES
    DefaultLanguageProperty:
      type: string
      description: Default locale for the consent tree
      example: es-ES
    ChangeLogProperty:
      type: string
      maxLength: 200
      description: Description of the changes made in this update
      example: Added new consent
    ChangesDescriptionProperty:
      type: string
      maxLength: 200
      description: Optional description of the changes made
      example: Added new language
    AllowedLanguages:
      type: array
      minItems: 1
      items:
        $ref: '#/components/schemas/Language'
      description: List of allowed languages to ask consent text for
      example:
        - es
        - eu
        - en
    PriorityConsentIds:
      type: array
      minItems: 1
      items:
        $ref: '#/components/schemas/ConsentId'
      description: List of priority consent Ids
    ConsentsOrder:
      type: array
      minItems: 1
      items:
        $ref: '#/components/schemas/ConsentId'
      description: Order of consents in the tree when visualized by user
    ConsentsViews:
      type: array
      items:
        $ref: '#/components/schemas/ConsentTreeView'
      description: Different views (group of consents) for the consent tree
    ConsentsDependencies:
      type: array
      items:
        $ref: '#/components/schemas/ConsentDependency'
      description: (Optional) Dependencies between consents
    CaptureChannels:
      type: array
      minItems: 1
      items:
        type: string
      description: Channels where the consent tree is applicable to be captured
      example:
        - crm
        - agents
        - web
        - whatsapp
        - landing
    CreateConsentDetails:
      type: object
      required:
        - language
        - text
        - description
      properties:
        language:
          $ref: '#/components/schemas/Language'
        text:
          $ref: '#/components/schemas/ConsentText'
        description:
          $ref: '#/components/schemas/ConsentDescription'
        short_text:
          type: string
          maxLength: 250
          description: Shortened version of the consent text
          example: Información de otros servicios contratados
    ConsentDetails:
      type: object
      required:
        - language
        - text
        - description
        - short_text
      properties:
        language:
          $ref: '#/components/schemas/Language'
        text:
          $ref: '#/components/schemas/ConsentText'
        description:
          $ref: '#/components/schemas/ConsentDescription'
        short_text:
          type: string
          maxLength: 250
          description: Shortened version of the consent text
          example: Información de otros servicios contratados
    UserConsentSelection:
      type: object
      required:
        - id
        - choice
      properties:
        id:
          $ref: '#/components/schemas/ConsentId'
        choice:
          $ref: '#/components/schemas/ConsentChoice'
    ConsentTreeView:
      type: object
      required:
        - view
        - consents
      properties:
        view:
          type: string
          description: Name of the view
          example: MANDATORY
        consents:
          type: array
          items:
            $ref: '#/components/schemas/ConsentId'
          description: Consents included in the view
    ConsentDependency:
      type: object
      required:
        - father
        - child
      properties:
        father:
          $ref: '#/components/schemas/ConsentId'
        child:
          type: array
          description: consent_id of the child consents dependent on the father
          items:
            $ref: '#/components/schemas/ConsentId'
    GetConsentsResponse:
      type: object
      required:
        - locale
        - statements
      properties:
        statements:
          description: >-
            Tree structure for consents and default choices where keys are
            identifiers
          type: array
          items:
            $ref: '#/components/schemas/GetConsentStatement'
        locale:
          $ref: '#/components/schemas/LocaleProperty'
    PostConsentsResponse:
      type: object
      required:
        - id
      properties:
        id:
          type: string
          example: identifier-6c54-4b01-90e6-d701748f0851
          description: User consents unique identifier at Mas Consents
    ImportConsentsResponse:
      type: object
      required:
        - customer_id
      properties:
        customer_id:
          type: string
          example: identifier-6c54-4b01-90e6-d701748f0851
          description: User consents external identifier
    GetConsentStatement:
      type: object
      required:
        - id
        - choice
        - choice_type
        - text
        - description
        - child_statements
        - read_only
      properties:
        id:
          $ref: '#/components/schemas/ConsentId'
        choice:
          $ref: '#/components/schemas/ConsentChoice'
        choice_type:
          $ref: '#/components/schemas/ConsentType'
        text:
          $ref: '#/components/schemas/ConsentText'
        description:
          $ref: '#/components/schemas/ConsentDescription'
        expiration_date:
          type: string
          format: date-time
          nullable: true
          description: >-
            ISO-8601 timestamp (UTC) indicating when this consent expires.

            - `null`: Consent is perpetual (never expires) OR user never
            captured it (PENDING)

            - Future date: Consent valid until this timestamp

            - Past date: Consent has expired (functionally treated as PENDING
            for filtering)
          example: '2026-05-15T10:00:00.000Z'
        read_only:
          type: boolean
          description: >-
            Indicates whether the consent can be modified:

            - `false`: The consent is editable (user can change their decision)

            - `true`: The consent is read-only (shown for context, not editable)


            When using `consent_ids` filter:

            - Explicitly requested consents have `read_only: false`

            - Auto-included parent consents (for context) have `read_only: true`


            Without filters, all consents have `read_only: false` (default
            behavior).
          example: false
        child_statements:
          description: Nested user consent statements
          type: array
          items:
            $ref: '#/components/schemas/GetConsentStatement'
    PostConsentsCustomerRequest:
      type: object
      required:
        - actor_id
        - selections
        - ip
        - sell_channel
        - trace_id
        - capture_date
      properties:
        actor_id:
          $ref: '#/components/schemas/ActorIdProperty'
        selections:
          type: array
          items:
            $ref: '#/components/schemas/UserConsentSelection'
          description: 'User cosents choices, in array format, chosen by the user'
        ip:
          $ref: '#/components/schemas/IpAddressProperty'
        sell_channel:
          $ref: '#/components/schemas/SellChannel'
        trace_id:
          $ref: '#/components/schemas/TraceIdProperty'
        capture_date:
          $ref: '#/components/schemas/DateTimeProperty'
    ImportCustomerConsentsRequest:
      type: object
      required:
        - actor_id
        - selections
        - sell_channel
        - trace_id
      properties:
        actor_id:
          $ref: '#/components/schemas/ActorIdProperty'
        selections:
          type: array
          items:
            $ref: '#/components/schemas/UserConsentSelection'
          description: User consents choices imported from a legacy system
        ip:
          $ref: '#/components/schemas/IpAddressProperty'
        sell_channel:
          $ref: '#/components/schemas/SellChannel'
        trace_id:
          $ref: '#/components/schemas/TraceIdProperty'
        capture_date:
          $ref: '#/components/schemas/DateTimeProperty'
    UpdateCustomerIdRequest:
      type: object
      required:
        - new_customer_id
        - actor_id
      properties:
        new_customer_id:
          type: string
          description: New MasStack customer identifier
          example: masstack-uuid-abc456
        actor_id:
          $ref: '#/components/schemas/ActorIdProperty'
    UpdateCustomerIdResponse:
      type: object
      required:
        - customer_id
        - selections
      properties:
        customer_id:
          type: string
          description: New customer identifier associated with the consent user
          example: masstack-uuid-abc456
        selections:
          type: array
          items:
            $ref: '#/components/schemas/UpdateCustomerIdSelection'
    UpdateCustomerIdSelection:
      type: object
      required:
        - id
        - choice
      properties:
        id:
          $ref: '#/components/schemas/ConsentId'
        choice:
          type: string
          description: Current consent choice after customer identifier reassociation
          enum:
            - ACCEPTED
            - PENDING
            - REJECTED
          example: ACCEPTED
    GetUserMetadataResponse:
      type: object
      required:
        - customer_id
        - impact
      properties:
        customer_id:
          type: string
          description: The customer identifier at CRM
          example: '439885739840'
        impact:
          description: >-
            Define if user it is an impactable user. This is the field that will
            be taken into account for the launch of campaigns or popups for the
            capture of consents
          type: boolean
    ExpirationPolicy:
      type: object
      description: >-
        Policy that defines the expiration behavior of a consent. Only
        applicable to OPT_IN consent types.
      required:
        - duration
      properties:
        duration:
          type: string
          description: >-
            ISO-8601 period duration (e.g., P90D for 90 days, P6M for 6 months,
            P1Y for 1 year). Maximum allowed is P1Y.
          example: P90D
    CreateConsentRequest:
      type: object
      required:
        - id
        - type
        - consent
      properties:
        id:
          $ref: '#/components/schemas/ConsentId'
        type:
          $ref: '#/components/schemas/ConsentType'
        expiration_policy:
          $ref: '#/components/schemas/ExpirationPolicy'
        consent:
          type: array
          items:
            $ref: '#/components/schemas/CreateConsentDetails'
          description: Array of consent details for different locales
    SavedConsentResponse:
      type: object
      required:
        - id
        - languages
      properties:
        id:
          $ref: '#/components/schemas/ConsentId'
        languages:
          $ref: '#/components/schemas/AllowedLanguages'
    UpdateConsentRequest:
      type: object
      required:
        - consent
      properties:
        consent:
          type: array
          items:
            $ref: '#/components/schemas/CreateConsentDetails'
        changes_description:
          $ref: '#/components/schemas/ChangesDescriptionProperty'
    CreateConsentTreeRequest:
      type: object
      required:
        - description
        - default_language
        - allowed_languages
        - consents_order
        - priority_consent_ids
        - views
        - channels
        - users_type
      properties:
        description:
          $ref: '#/components/schemas/ConfigurationTreeDescription'
        default_language:
          $ref: '#/components/schemas/DefaultLanguageProperty'
        allowed_languages:
          $ref: '#/components/schemas/AllowedLanguages'
        consents_order:
          $ref: '#/components/schemas/ConsentsOrder'
        priority_consent_ids:
          $ref: '#/components/schemas/PriorityConsentIds'
        views:
          $ref: '#/components/schemas/ConsentsViews'
        dependencies:
          $ref: '#/components/schemas/ConsentsDependencies'
        channels:
          $ref: '#/components/schemas/CaptureChannels'
        users_type:
          $ref: '#/components/schemas/UserType'
    UpdateConsentTreeRequest:
      type: object
      required:
        - description
        - default_language
        - allowed_languages
        - consents_order
        - priority_consent_ids
        - views
        - channels
        - users_type
        - change_log
      properties:
        description:
          $ref: '#/components/schemas/ConfigurationTreeDescription'
        default_language:
          $ref: '#/components/schemas/DefaultLanguageProperty'
        allowed_languages:
          $ref: '#/components/schemas/AllowedLanguages'
        consents_order:
          $ref: '#/components/schemas/ConsentsOrder'
        priority_consent_ids:
          $ref: '#/components/schemas/PriorityConsentIds'
        change_log:
          $ref: '#/components/schemas/ChangeLogProperty'
        views:
          $ref: '#/components/schemas/ConsentsViews'
        dependencies:
          $ref: '#/components/schemas/ConsentsDependencies'
        channels:
          $ref: '#/components/schemas/CaptureChannels'
        users_type:
          $ref: '#/components/schemas/UserType'
    GetConsentsDefinitionsResponse:
      type: object
      required:
        - consents
      properties:
        consents:
          type: array
          items:
            type: object
            required:
              - id
              - choice_type
              - consent
              - creation_date
            properties:
              id:
                $ref: '#/components/schemas/ConsentId'
              choice_type:
                $ref: '#/components/schemas/ConsentType'
              consent:
                type: array
                items:
                  $ref: '#/components/schemas/ConsentDetails'
              subject:
                $ref: '#/components/schemas/EmailSubject'
              creation_date:
                allOf:
                  - $ref: '#/components/schemas/DateTimeProperty'
                  - description: Date and time when the consent was created
              expiration_policy:
                $ref: '#/components/schemas/ExpirationPolicy'
    GetConsentTreesResponse:
      type: object
      required:
        - trees
      properties:
        trees:
          type: array
          items:
            $ref: '#/components/schemas/ConfigurationTree'
          description: List of consent trees configurations
    ConfigurationTree:
      type: object
      required:
        - segment
        - users_type
        - default_locale
        - allowed_locales
        - consents_order
        - views
        - channels
        - creation_subject
        - creation_date
      properties:
        segment:
          $ref: '#/components/schemas/UserSegment'
        users_type:
          $ref: '#/components/schemas/UserType'
        description:
          $ref: '#/components/schemas/ConfigurationTreeDescription'
        default_locale:
          type: string
          description: Default language for the consent tree
          example: es
        allowed_locales:
          $ref: '#/components/schemas/AllowedLanguages'
        consents_order:
          $ref: '#/components/schemas/ConsentsOrder'
        priority_consent_ids:
          $ref: '#/components/schemas/PriorityConsentIds'
        views:
          $ref: '#/components/schemas/ConsentsViews'
        dependencies:
          $ref: '#/components/schemas/ConsentsDependencies'
        channels:
          $ref: '#/components/schemas/CaptureChannels'
        creation_subject:
          allOf:
            - $ref: '#/components/schemas/EmailSubject'
            - description: Email or identifier of the user who created the consent tree
        creation_date:
          allOf:
            - $ref: '#/components/schemas/DateTimeProperty'
            - description: Date and time when the consent tree was created
    AuditInfo:
      type: object
      required:
        - audience
        - subject
        - change_log
      properties:
        audience:
          type: string
          description: The intended recipient or system for this consent tree
          example: masstack.auth.masmovil.com
        subject:
          $ref: '#/components/schemas/EmailSubject'
        change_log:
          $ref: '#/components/schemas/ChangeLogProperty'
    ArchivedConsentTree:
      type: object
      description: Historical archived version of a consent tree configuration
      required:
        - version
        - creation_date
        - audit_info
        - segment
        - users_type
        - description
        - default_language
        - allowed_languages
        - consents_order
        - priority_consent_ids
        - views
        - dependencies
        - captured_channels
      properties:
        version:
          type: string
          description: Unique identifier for this archived tree version
        creation_date:
          $ref: '#/components/schemas/DateTimeProperty'
        audit_info:
          $ref: '#/components/schemas/AuditInfo'
        segment:
          $ref: '#/components/schemas/UserSegment'
        users_type:
          $ref: '#/components/schemas/UserType'
        description:
          $ref: '#/components/schemas/ConfigurationTreeDescription'
        default_language:
          $ref: '#/components/schemas/DefaultLanguageProperty'
        allowed_languages:
          $ref: '#/components/schemas/AllowedLanguages'
        consents_order:
          $ref: '#/components/schemas/ConsentsOrder'
        priority_consent_ids:
          $ref: '#/components/schemas/PriorityConsentIds'
        views:
          $ref: '#/components/schemas/ConsentsViews'
        dependencies:
          $ref: '#/components/schemas/ConsentsDependencies'
        captured_channels:
          $ref: '#/components/schemas/CaptureChannels'
    GetConsentTreeHistoryResponse:
      type: object
      required:
        - page
        - page_size
        - trees_history
      properties:
        page:
          type: integer
          description: Current page number
          example: 0
        page_size:
          type: integer
          description: Number of items per page
          example: 50
        trees_history:
          type: array
          description: >-
            Array of historical consent tree configurations ordered in
            descending chronological order
          items:
            $ref: '#/components/schemas/ArchivedConsentTree'
    GetConsentsDefinitionsHistoryResponse:
      type: object
      required:
        - page
        - page_size
        - consents
      properties:
        page:
          type: integer
          description: Current page number
          example: 0
        page_size:
          type: integer
          description: Number of items per page
          example: 50
        consents:
          type: array
          description: Array of historical consent definitions for the specified consent_id
          items:
            type: object
            required:
              - version
              - audit_info
              - creation_date
              - consent
              - choice_type
            properties:
              version:
                type: string
                description: Unique identifier for this archived consent definition version
                example: 08ad0cd1-2a95-40b2-ab05-cf2c0bb33114
              audit_info:
                $ref: '#/components/schemas/AuditInfo'
              creation_date:
                $ref: '#/components/schemas/DateTimeProperty'
              choice_type:
                $ref: '#/components/schemas/ConsentType'
              expiration_policy:
                $ref: '#/components/schemas/ExpirationPolicy'
              consent:
                type: array
                items:
                  $ref: '#/components/schemas/ConsentDetails'
    ErrorsResponse:
      type: object
      properties:
        errors:
          $ref: '#/components/schemas/Errors'
      description: Errors response
    Errors:
      type: array
      description: List of errors
      items:
        $ref: '#/components/schemas/Error'
    Error:
      type: object
      required:
        - code
        - title
        - ref
        - details
      properties:
        code:
          type: string
          example: MCONS_CODE
          description: |-
            Error codes:
             * `MCONS-000` - Internal server error
             * `MCONS-001` - Bad request. Parameter is required but it's missing
             * `MCONS-002` - Bad request. Error during parsing
             * `MCONS-003` - Bad request. Illegal or inappropriate argument
             * `MCONS-004` - Bad request. Model validation
             * `MCONS-005` - Unauthorized
             * `MCONS-006` - Resource not found
             * `MCONS-007` - Unauthorized
             * `MCONS-008` - Unauthorized
             * `MCONS-009` - Unauthorized
             * `MCONS-010` - Conflict
        title:
          type: string
          example: ERROR_TITLE
          description: |-
            Error titles:
             * `PARAMETER_ERROR` - Bad request. Parameter is required but it's missing
             * `BODY_ERROR` - Bad request. Error during parsing
             * `ILLEGAL_ARGUMENT_ERROR` - Bad request. Illegal or inappropriate argument
             * `NOT_VALID_MODEL_ERROR` - Bad request. Model validation
             * `INVALID_HEADER_ERROR` - Unauthorized
             * `RESOURCE_NOT_FOUND` - Resource not found
             * `INVALID_AUTHN_HEADER_ERROR` - Unauthorized
             * `NOT_VALID_AUTHN_TOKEN_ERROR` - Unauthorized
        ref:
          type: string
          example: >-
            https://developers.masstack.com/en/docs/apis_consents_doc_swagger/2/schemas/#schemaerror
          description: Url of the error details in developer portal
        details:
          type: string
          example: Details of the error
          description: Message and details of the error
    SecurizeRequestBody:
      type: object
      description: Consents securize payload schema
      required:
        - customer_id
        - actor_id
      properties:
        customer_id:
          type: string
        actor_id:
          type: string
    SecurizeResponse:
      type: object
      description: Test
      required:
        - web_component_token
      properties:
        web_component_token:
          type: string
  responses:
    BadRequest:
      description: Request input is not valid
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorsResponse'
    NotFound:
      description: The specified resource was not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorsResponse'
    Unauthorized:
      description: The user is not authorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorsResponse'
    InternalServerError:
      description: The request failed to be processed by the server
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorsResponse'
    Conflict:
      description: >-
        The request could not be completed due to a conflict with the current
        state of the target resource
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorsResponse'
  parameters:
    OrgIdPathParam:
      name: org_id
      in: path
      required: true
      description: The string id related with one of available tenants/organizations
      schema:
        type: string
      example: masmovil
    CustomerIdPathParam:
      name: customer_id
      in: path
      required: true
      description: The customer identifier at CRM
      schema:
        type: string
      example: '419024875567'
    ConsentIdPathParam:
      name: consent_id
      in: path
      required: true
      description: The unique identifier of the consent definition to be updated
      schema:
        $ref: '#/components/schemas/ConsentId'
      example: C01
    XSectorHeaderParam:
      name: x-sector
      in: header
      required: false
      description: The regulated sector where customer belongs to
      schema:
        $ref: '#/components/schemas/UserSegment'
      example: telco
      deprecated: true
    XSegmentHeaderParam:
      name: x-segment
      in: header
      required: false
      description: >-
        The user's segment where the consent tree applies (replace x-sector
        deprecated header). Is mandatory sent at one of 'x-sector' or
        'x-segment' headers.
      schema:
        $ref: '#/components/schemas/UserSegment'
      example: telco
    XSegmentHeaderParamRequired:
      name: x-segment
      in: header
      required: true
      description: The user's segment where the consent tree applies
      schema:
        $ref: '#/components/schemas/UserSegment'
      example: telco
    AcceptLanguageHeaderParam:
      name: Accept-Language
      in: header
      description: >-
        Language and country in locale format (defined in RFC 5646, which rely
        on the ISO 639) used to

        retrieve user consent texts. Not all values are available to all
        organizations.

        If Locale text it is not defined, a default locale text will be
        provided.

        Locale defined lists:

        * `es-ES` - Spanish language, country Spain

        * `eu-ES` - Basque language, country Spain

        * `en-ES` - English language, country Spain

        * `de-ES` - German language, country Spain

        * `ca-ES` - Catalan language, country Spain
      schema:
        type: string
        example: es-ES
    XKeyHeaderParam:
      name: x-key
      in: header
      required: true
      description: Allow operation key
      schema:
        type: string
        example: 6b9c495a512cb4a7132a5afdd9f295f73dcfae7d70cd1aadc917625d392f8523
    ETagHeaderParam:
      name: ETag
      in: header
      required: true
      description: >-
        Transaction ID from the configuration tree GET response, used for
        optimistic concurrency control
      schema:
        type: string
      example: >-
        548d1e9f-159c-4223-a1fb-9c7d2a0da142,5c20565c-d16e-4b32-8ba7-519f909402b3
    ViewQueryParam:
      name: view
      in: query
      required: false
      description: >-
        Filters the subset of Consents that are going to be showed. They can be
        combined with each other. If two views containing shared consents are
        selected, the largest grouping will be displayed.

        If not specified, all consents configured will be showed.

        Allowed values are configured by the organization's administrator
      schema:
        type: array
        items:
          type: string
      example: MANDATORY
    DisplayFormatQueryParam:
      name: display_format
      in: query
      required: false
      description: >-
        Optional parameter indicating the length of the text of the requested
        consents.

        Possible values are:
          * `SHORT` - Returns the shortened version of the consent text.
          * `NORMAL` - Returns the default long text of the consent.
          * (not set) - Returns the normal consent text.
      schema:
        type: string
      example: SHORT
    PaginationPageParam:
      name: page
      in: query
      required: false
      description: Page number for pagination
      schema:
        type: integer
        default: 0
        minimum: 0
      example: '1'
    PaginationPageSizeParam:
      name: page_size
      in: query
      required: false
      description: Number of items per page
      schema:
        type: integer
        default: 50
        minimum: 1
        maximum: 100
      example: '50'
    UsersTypeParam:
      name: users_type
      in: query
      required: false
      description: >-
        Filter by group of users where the consent tree applies to [ customers,
        leads ]
      schema:
        type: string
      example: customers
    ConsentIdsQueryParam:
      name: consent_ids
      in: query
      required: false
      description: >-
        Filter consents by specific IDs. Returns only the requested consents and
        their parent hierarchy for context.

        Format: comma-separated list of consent IDs.


        **Interpretation rules:**

        - If a parent ID is requested: Returns the full family (parent + all
        children) with `read_only: false`

        - If only child IDs are requested: Returns the children with `read_only:
        false` and auto-includes their parents with `read_only: true` (for
        context only)

        - If both parent and child are requested: Treated as requesting the full
        family (all `read_only: false`)


        Can be combined with `view` filter (intersection/AND logic) and `choice`
        filter.

        Requested IDs that do not exist in the current configuration tree are
        ignored without causing any error.

        If none of the requested IDs exist, an empty array is returned in the
        consents response field.
      schema:
        type: string
      example: 'FRAUD_KYCMATCH_WHATSAPP,FRAUD_DEVICESWAP_WHATSAPP'
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
