> ## Documentation Index
> Fetch the complete documentation index at: https://api-docs.spott.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create consent

> Create a new consent record for a candidate. Requires consent details including purpose, legal basis, and validity period.



## OpenAPI

````yaml /openapi-private.json post /consents
openapi: 3.1.0
info:
  title: Spott API Reference
  version: '0.1'
servers:
  - url: https://api.gospott.com
security: []
tags: []
paths:
  /consents:
    post:
      tags:
        - Consents
      summary: Create consent
      description: >-
        Create a new consent record for a candidate. Requires consent details
        including purpose, legal basis, and validity period.
      operationId: createConsent
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateConsentDto'
      responses:
        '201':
          description: Consent created successfully. Returns the consent ID.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateRecordResponseDto'
        '400':
          description: Bad request - invalid consent data
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ExceptionBaseDto'
                  - type: object
                    properties:
                      statusCode:
                        type: number
                        example: 400
                      message:
                        type: string
                        example: 'Validation failed: candidateId is required'
                      error:
                        type: string
                        example: Bad Request
        '401':
          description: Unauthorized - invalid or missing authentication
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExceptionBaseDto'
        '500':
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExceptionBaseDto'
      security:
        - x-api-key: []
components:
  schemas:
    CreateConsentDto:
      type: object
      properties:
        candidateId:
          type: string
          minLength: 1
        framework:
          anyOf:
            - $ref: '#/components/schemas/ConsentFramework'
            - type: 'null'
          description: The regulatory framework
        legalBasis:
          $ref: '#/components/schemas/ConsentLegalBasis'
          description: The legal basis for the consent
        purpose:
          $ref: '#/components/schemas/ConsentPurposeRequestDto'
        comments:
          anyOf:
            - type: string
              minLength: 1
            - type: 'null'
          description: Free text field for additional comments
        receivedAt:
          $ref: '#/components/schemas/DateISO'
        validUntil:
          $ref: '#/components/schemas/DateISO'
      required:
        - candidateId
        - framework
        - legalBasis
        - purpose
        - comments
        - receivedAt
        - validUntil
      id: PrivateCreateConsentDto
    CreateRecordResponseDto:
      type: object
      properties:
        id:
          type: string
          minLength: 1
      required:
        - id
      id: CreateRecordResponseDto
    ExceptionBaseDto:
      type: object
      properties:
        status:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        message:
          type: string
        requestId:
          type: string
      required:
        - status
        - message
        - requestId
      id: ExceptionBaseDto
    ConsentFramework:
      type: string
      enum:
        - GDPR
        - PDPO
      id: ConsentFramework
    ConsentLegalBasis:
      type: string
      enum:
        - CONSENT
        - CONTRACT
        - LEGAL_OBLIGATION
        - VITAL_INTEREST
        - PUBLIC_TASK
        - LEGITIMATE_INTEREST
      id: ConsentLegalBasis
    ConsentPurposeRequestDto:
      oneOf:
        - $ref: '#/components/schemas/SystemConsentPurposeRequestDto'
        - $ref: '#/components/schemas/CustomConsentPurposeRequestDto'
      description: The purpose of the consent
      id: PrivateConsentPurposeRequestDto
    DateISO:
      id: DateISO
      format: date-time
      anyOf:
        - type: string
          format: date-time
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
        - type: string
          format: date
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$
    SystemConsentPurposeRequestDto:
      type: object
      properties:
        type:
          type: string
          enum:
            - system
        name:
          $ref: '#/components/schemas/SystemConsentPurpose'
          description: The purpose of the consent
      required:
        - type
        - name
      id: PrivateSystemConsentPurposeRequestDto
    CustomConsentPurposeRequestDto:
      type: object
      properties:
        type:
          type: string
          enum:
            - custom
        id:
          type: string
          minLength: 1
      required:
        - type
        - id
      id: PrivateCustomConsentPurposeRequestDto
    SystemConsentPurpose:
      type: string
      enum:
        - RECRUITING
        - MARKETING_EMAIL
        - MARKETING_SMS
        - WHATSAPP_BUSINESS_UTILITY
        - WHATSAPP_BUSINESS_MARKETING
      id: SystemConsentPurpose
  securitySchemes:
    x-api-key:
      type: apiKey
      name: x-api-key
      in: header
      description: >-
        API key for authentication. Get your API key from Settings → API Keys in
        your Spott dashboard.

````