> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://infonite.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://infonite.dev/_mcp/server.

# On Consent Submitted

POST 

Triggered when the user explicitly accepts the consent terms and legal documents within the widget. If an `aes_key` was provided during [Create Session](api:POST/es-public-administration/v1/manager/init), the consent metadata inside the `data` payload will be delivered encrypted in `aes::Base64(IV + Ciphertext + Tag)` format.

<Card title="Encrypted Payload" icon="fa-solid fa-key" href="/payload-encryption">
  If you configured an `aes_key`, this payload is encrypted. View step-by-step decryption walkthrough and code templates in the **Payload Encryption** guide.
</Card>

If no `aes_key` was specified, the `data` payload is omitted (null).


Reference: https://infonite.dev/api-reference/spain-public-administration/spain-public-administration-api/webhooks/webhook-es-public-administration-consent

## OpenAPI 3.1 Webhook Specification

```yaml
openapi: 3.1.0
info:
  title: es-public-administration-v1-0-0-openapi
  version: 1.0.0
paths: {}
webhooks:
  subpackage_webhooks.webhook:es-public-administration:consent:
    post:
      operationId: subpackage_webhooks.webhook:es-public-administration:consent
      summary: On Consent Submitted
      description: >
        Triggered when the user explicitly accepts the consent terms and legal
        documents within the widget. If an `aes_key` was provided during [Create
        Session](api:POST/es-public-administration/v1/manager/init), the consent
        metadata inside the `data` payload will be delivered encrypted in
        `aes::Base64(IV + Ciphertext + Tag)` format.


        <Card title="Encrypted Payload" icon="fa-solid fa-key"
        href="/payload-encryption">
          If you configured an `aes_key`, this payload is encrypted. View step-by-step decryption walkthrough and code templates in the **Payload Encryption** guide.
        </Card>


        If no `aes_key` was specified, the `data` payload is omitted (null).
      responses:
        '200':
          description: Webhook received successfully
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookConsentPayload'
components:
  schemas:
    WebhookConsentPayloadStatusCode:
      type: string
      enum:
        - READY
        - WAITING
        - COMPLETED
        - FAILED
        - SYSTEM_CANCELLED
        - CLIENT_CANCELLED
        - CUSTOMER_CANCELLED
        - TIMED_OUT
        - CONFIGURATION_ERROR
      description: >-
        Base status codes for widget flows

        Allowed values are:
         - `READY`: The flow is waiting for an input
        - `WAITING`: Flow is waiting for an external event

        - `COMPLETED`: The flow has finalized successfully

        - `FAILED`: The flow has failed

        - `SYSTEM_CANCELLED`: The flow has ben cancelled by the system

        - `CLIENT_CANCELLED`: The flow has been cancelled by the client

        - `CUSTOMER_CANCELLED`: The flow has been cancelled by the customer

        - `TIMED_OUT`: The flow has timed out

        - `CONFIGURATION_ERROR`: The flow has been rejected due to a
        configuration error
      title: WebhookConsentPayloadStatusCode
    CatgridFlowsFlowsEsPublicAdministrationV1MachineOutConsentOutputOutAcceptedFeaturesItems:
      type: string
      enum:
        - accounts_read
        - cards_read
        - deposits_read
        - loans_read
        - credits_read
        - investment_accounts_read
        - funds_read
        - stocks_read
        - pensions_read
        - accounts_certificates
        - direct_debits_read
        - customer_information_read
        - source_contracts_read
        - cloud_resource_read
        - supplier_invoices_read
        - client_invoices_read
        - labor_check
        - public_pensions
        - public_document_verification
        - yearly_individual_tax
        - vehicles_data
        - driver_data
        - academic_data
        - properties_data
        - credit_registry_data
      description: |-
        Features allowed by an engine
        Allowed values are:
         - `accounts_read`: Financial Accounts Read
        - `cards_read`: Financial Cards Read
        - `deposits_read`: Financial Deposits Read
        - `loans_read`: Financial Loans Read
        - `credits_read`: Financial Credits Read
        - `investment_accounts_read`: Investment Accounts Read
        - `funds_read`: Investment Funds Read
        - `stocks_read`: Investment Stocks Read
        - `pensions_read`: Pension Plans Read
        - `accounts_certificates`: Account Certificates Read
        - `direct_debits_read`: Direct Debits Read
        - `customer_information_read`: Customer Information Read
        - `source_contracts_read`: Source Contracts Read
        - `cloud_resource_read`: Cloud Provider Resource Read
        - `supplier_invoices_read`: Supplier Invoices Read
        - `client_invoices_read`: Client Invoices Read
        - `labor_check`: Labor Check
        - `public_pensions`: Public Pensions
        - `public_document_verification`: Public Document Verification
        - `yearly_individual_tax`: Yearly Taxes for Individuals
        - `vehicles_data`: Vehicles Data
        - `driver_data`: Driver Data
        - `academic_data`: Academic Data
        - `properties_data`: Properties Data
        - `credit_registry_data`: Credit Registry Data
      title: >-
        CatgridFlowsFlowsEsPublicAdministrationV1MachineOutConsentOutputOutAcceptedFeaturesItems
    IdentificationNumberDtoType:
      type: string
      enum:
        - unknown
        - es:dni
        - es:nie
        - es:cif
        - es:ssn
        - co:cc
        - co:ce
        - co:nit
        - co:ti
      default: unknown
      description: |-
        Types of identification numbers
        Allowed values are:
         - `unknown`: Unknown/Unspecified
        - `es:dni`: Spanish DNI
        - `es:nie`: Spanish NIE
        - `es:cif`: Spanish CIF
        - `es:ssn`: Spanish Social Security Number
        - `co:cc`: Colombian Cédula de Ciudadanía
        - `co:ce`: Colombian Cédula de Extranjería
        - `co:nit`: Colombian NIT
        - `co:ti`: Colombian Tarjeta de Identidad
      title: IdentificationNumberDtoType
    _IdentificationNumberDto:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/IdentificationNumberDtoType'
          default: unknown
          description: |-
            Types of identification numbers
            Allowed values are:
             - `unknown`: Unknown/Unspecified
            - `es:dni`: Spanish DNI
            - `es:nie`: Spanish NIE
            - `es:cif`: Spanish CIF
            - `es:ssn`: Spanish Social Security Number
            - `co:cc`: Colombian Cédula de Ciudadanía
            - `co:ce`: Colombian Cédula de Extranjería
            - `co:nit`: Colombian NIT
            - `co:ti`: Colombian Tarjeta de Identidad
        value:
          type: string
        validated:
          type: boolean
          default: false
        country:
          type:
            - string
            - 'null'
          format: country
        valid_until:
          type:
            - string
            - 'null'
          format: date
      required:
        - value
      description: >-
        An identification number with autodetection: validating a PLAIN STRING
        picks the

        best-matching type and runs its stdnum validator; the after-validator
        then recomputes

        `validated` and `country` from the type — never trust them as input.
      title: _IdentificationNumberDto
    Out-Output:
      type: object
      properties:
        version:
          type: string
          description: The version tag of the document template accepted.
        hash:
          type: string
          description: >-
            SHA-256 hash of the document content or template for integrity
            checks.
        sign_date:
          type: string
          format: datetime
          description: >-
            Date and time when the document was signed digitally, or None if not
            signed.
        signature_provider:
          type: string
          description: >-
            The signature service used (e.g., 'yousign', 'signaturit',
            'internal').
        signature_metadata:
          type: object
          additionalProperties:
            description: Any type
          description: >-
            Arbitrary dictionary to store signature-specific identifiers,
            transaction tokens,

            or provider callback payloads.
      required:
        - version
      title: Out-Output
    catgrid_flows__flows__es_public_administration__v1__machine__out__ConsentOutput__Out:
      type: object
      properties:
        accepted_date:
          type: string
          format: datetime
        accepted_features:
          type: array
          items:
            $ref: >-
              #/components/schemas/CatgridFlowsFlowsEsPublicAdministrationV1MachineOutConsentOutputOutAcceptedFeaturesItems
        user_ip:
          type: string
        user_agent:
          type: string
        origin:
          type: string
        user_phone:
          type: string
        user_email:
          type: string
        user_full_name:
          type: string
        user_identification:
          $ref: '#/components/schemas/_IdentificationNumberDto'
        accepted_documents:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Out-Output'
      required:
        - accepted_features
      description: Consent and documents accepted by the customer.
      title: >-
        catgrid_flows__flows__es_public_administration__v1__machine__out__ConsentOutput__Out
    WebhookConsentPayload:
      type: object
      properties:
        event_class:
          type: string
          enum:
            - EsPublicAdministrationV1FlowEvent
          description: >-
            Payload class discriminator — always this value for Spain Public
            Administration events.
        app_id:
          type: string
          format: ObjectId
        customer_id:
          type: string
        session_id:
          type: string
          format: ObjectId
        producer:
          type: string
          enum:
            - es-public-administration
          description: The flow that produced the event.
        event:
          type: string
          enum:
            - es-public-administration:consent
          description: 'The event type: `consent`.'
        date:
          type: string
          format: datetime
        status_code:
          $ref: '#/components/schemas/WebhookConsentPayloadStatusCode'
          description: >-
            Base status codes for widget flows

            Allowed values are:
             - `READY`: The flow is waiting for an input
            - `WAITING`: Flow is waiting for an external event

            - `COMPLETED`: The flow has finalized successfully

            - `FAILED`: The flow has failed

            - `SYSTEM_CANCELLED`: The flow has ben cancelled by the system

            - `CLIENT_CANCELLED`: The flow has been cancelled by the client

            - `CUSTOMER_CANCELLED`: The flow has been cancelled by the customer

            - `TIMED_OUT`: The flow has timed out

            - `CONFIGURATION_ERROR`: The flow has been rejected due to a
            configuration error
        status_message:
          type:
            - string
            - 'null'
        data:
          $ref: >-
            #/components/schemas/catgrid_flows__flows__es_public_administration__v1__machine__out__ConsentOutput__Out
      required:
        - event_class
        - app_id
        - customer_id
        - session_id
        - producer
        - event
        - status_code
      description: >-
        Fired when the end user signs the consent: from this point the sources
        can be queried on

        their behalf.
      title: WebhookConsentPayload

```