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

# Create a DNI session

> Allocate a tracking number for a website visitor so their inbound call is attributed to the campaign and traffic source that produced it. Returns the number to display, the session id, and its expiry.



## OpenAPI

````yaml /api-reference/openapi.json post /dni/session
openapi: 3.1.0
info:
  title: Compensable API
  version: 0.1.0
  description: >-
    Customer-facing endpoints of the Compensable control plane. Authenticate
    with a tenant API key: `Authorization: Bearer cmp_live_…`.
servers:
  - url: https://api.compensable.live
    description: Production
security: []
paths:
  /dni/session:
    post:
      tags:
        - Number tracking (DNI)
      summary: Create a DNI session
      description: >-
        Allocate a tracking number for a website visitor so their inbound call
        is attributed to the campaign and traffic source that produced it.
        Returns the number to display, the session id, and its expiry.
      operationId: create_dni_session_dni_session_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDniSessionRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DniSessionResponse'
        '401':
          description: Missing or invalid API key (`invalid_api_key`).
        '403':
          description: >-
            Key lacks the required scope (`insufficient_scope`), or API access
            is not enabled for the organization (`tracking_disabled`).
        '404':
          description: Campaign or call not found in your organization.
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: >-
            Rate limited (`rate_limited`). A per-organization limit applies to
            session creation.
      security:
        - ApiKeyBearer: []
components:
  schemas:
    CreateDniSessionRequest:
      properties:
        campaign_code:
          type: string
          maxLength: 3
          minLength: 1
          title: Campaign Code
        visitor_id:
          type: string
          maxLength: 256
          minLength: 1
          title: Visitor Id
        fbc:
          anyOf:
            - type: string
              maxLength: 512
            - type: 'null'
          title: Fbc
        fbp:
          anyOf:
            - type: string
              maxLength: 512
            - type: 'null'
          title: Fbp
        gclid:
          anyOf:
            - type: string
              maxLength: 512
            - type: 'null'
          title: Gclid
        landing_url:
          anyOf:
            - type: string
              maxLength: 2048
            - type: 'null'
          title: Landing Url
      additionalProperties: false
      type: object
      required:
        - campaign_code
        - visitor_id
      title: CreateDniSessionRequest
    DniSessionResponse:
      properties:
        tracking_number:
          type: string
          title: Tracking Number
        dni_session_id:
          type: string
          title: Dni Session Id
        expires_at:
          type: string
          title: Expires At
      type: object
      required:
        - tracking_number
        - dni_session_id
        - expires_at
      title: DniSessionResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiKeyBearer:
      type: http
      scheme: bearer
      bearerFormat: cmp_live_…
      description: >-
        Tenant API key, sent as `Authorization: Bearer cmp_live_…`. Keys are
        org-scoped and carry explicit scopes (`enroll`, `execute`). Any missing,
        malformed, unknown, revoked, or expired credential returns a generic 401
        `invalid_api_key`.

````