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

# Create a click

> Records a click on a partner's link from your own server, for visits the browser script cannot see. Identify the source by link_id, by partner_id with an optional link_id, or by the link's param and value; the partner and program are resolved from it. Pass the returned id as click_id when you create the customer.



## OpenAPI

````yaml /api-reference/openapi.json post /v2/clicks
openapi: 3.1.0
info:
  title: Tolt Public API
  version: 2.0.0
servers:
  - url: https://platform.tolt.dev
    description: Development
security:
  - bearerAuth: []
paths:
  /v2/clicks:
    post:
      tags:
        - Clicks
      summary: Create a click
      description: >-
        Records a click on a partner's link from your own server, for visits the
        browser script cannot see. Identify the source by link_id, by partner_id
        with an optional link_id, or by the link's param and value; the partner
        and program are resolved from it. Pass the returned id as click_id when
        you create the customer.
      operationId: createClick
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                link_id:
                  type: string
                  minLength: 1
                  description: >-
                    The link that was clicked. The partner and program are taken
                    from it.
                  example: lnk_7bYqA2
                partner_id:
                  type: string
                  minLength: 1
                  description: >-
                    The partner who generated the click. Use it when you know
                    the partner but not the link.
                  example: part_9fQ2xLL
                param:
                  type: string
                  minLength: 1
                  description: >-
                    The tracking parameter of the link, e.g. `ref`. Send it with
                    value when all you have is the landing URL.
                  example: ref
                value:
                  type: string
                  minLength: 1
                  description: >-
                    The value of the tracking parameter, e.g. `sam` in
                    `?ref=sam`.
                  example: sam
                country:
                  type: string
                  minLength: 2
                  maxLength: 2
                  description: Two-letter ISO country code where the click originated.
                  example: US
                device:
                  type: string
                  minLength: 1
                  description: Device type, e.g. `desktop`, `mobile` or `tablet`.
                  example: desktop
                page:
                  type: string
                  minLength: 1
                  description: URL of the page the visitor landed on.
                  example: https://acme.com/pricing
                referrer:
                  type: string
                  minLength: 1
                  description: URL of the referring page.
                  example: https://twitter.com
              example:
                link_id: lnk_mtTeeckFa1vMdvDFXretQNs6
                page: https://example.com/pricing?ref=sam
                referrer: https://partner.example.com
                country: US
                device: desktop
              description: >-
                Identify the click by one of link_id, partner_id, or param and
                value together. A request with none of them, or with only one of
                param and value, returns 400.
      responses:
        '201':
          description: The created click
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Request successful
                  data:
                    $ref: '#/components/schemas/Click'
                required:
                  - success
                  - message
                  - data
              example:
                success: true
                message: Successfully created click
                data:
                  id: clk_mEsbFYv6ZjqXjAoFwokjS6v6
                  page: https://example.com/pricing?ref=sam
                  referrer: https://partner.example.com
                  device: desktop
                  browser: null
                  country: US
                  state: null
                  link_id: lnk_mtTeeckFa1vMdvDFXretQNs6
                  program_id: prg_T6z8aRW3XCmvFWP972RKxpAd
                  partner_id: part_NLYzgNKuSuASvrvoxNtau6SY
                  created_at: '2026-10-01T12:00:00Z'
                  updated_at: '2026-10-01T12:00:00Z'
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
        '400':
          description: Invalid request, or the partner or link does not exist
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                success: false
                message: 'request: Invalid input: expected object, received null'
                code: validation_error
                doc_url: https://docs.tolt.com/errors#validation_error
                errors:
                  - field: request
                    message: 'Invalid input: expected object, received null'
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                success: false
                message: Unauthorized
                code: unauthorized
                doc_url: https://docs.tolt.com/errors#unauthorized
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    Click:
      type: object
      properties:
        id:
          type: string
          example: clk_mEsbFYv6ZjqXjAoFwokjS6v6
        page:
          type:
            - string
            - 'null'
          example: https://example.com/pricing?ref=sam
        referrer:
          type:
            - string
            - 'null'
          example: https://partner.example.com
        device:
          type:
            - string
            - 'null'
          example: desktop
        browser:
          type:
            - string
            - 'null'
          example: Chrome
        country:
          type:
            - string
            - 'null'
          example: United States
        state:
          type:
            - string
            - 'null'
          example: California
        link_id:
          type:
            - string
            - 'null'
          example: lnk_mtTeeckFa1vMdvDFXretQNs6
        program_id:
          type:
            - string
            - 'null'
          example: prg_T6z8aRW3XCmvFWP972RKxpAd
        partner_id:
          type:
            - string
            - 'null'
          example: part_NLYzgNKuSuASvrvoxNtau6SY
        created_at:
          type: string
          format: date-time
          example: '2026-10-01T12:00:00Z'
        updated_at:
          type: string
          format: date-time
          example: '2026-10-01T12:00:00Z'
      required:
        - id
        - page
        - referrer
        - device
        - browser
        - country
        - state
        - link_id
        - program_id
        - partner_id
        - created_at
        - updated_at
    Error:
      type: object
      properties:
        success:
          type: boolean
          example: false
        message:
          type: string
          description: Human-readable explanation. May change; branch on code instead.
        code:
          type: string
          enum:
            - bad_request
            - validation_error
            - invalid_reference
            - invalid_cursor
            - unauthorized
            - forbidden
            - not_found
            - conflict
            - already_exists
            - commission_paid
            - commission_frozen
            - transaction_refunded
            - commission_exists
            - rate_limited
            - payload_too_large
            - internal_error
          description: Stable machine-readable error code.
          example: not_found
        doc_url:
          type: string
          example: https://docs.tolt.com/errors#not_found
        errors:
          type: array
          items:
            type: object
            properties:
              field:
                type: string
              message:
                type: string
            required:
              - field
              - message
          description: >-
            One entry per offending field. Present on validation_error and
            invalid_reference.
      required:
        - success
        - message
        - code
        - doc_url
  headers:
    X-RateLimit-Limit:
      description: Requests allowed in the current window.
      schema:
        type: integer
    X-RateLimit-Remaining:
      description: Requests left in the current window.
      schema:
        type: integer
    X-RateLimit-Reset:
      description: Unix time, in seconds, when the window resets.
      schema:
        type: integer
    Retry-After:
      description: Seconds to wait before retrying.
      schema:
        type: integer
  responses:
    PayloadTooLarge:
      description: Request body exceeds 1 MB
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            success: false
            message: Request body exceeds 1 MB
            code: payload_too_large
            doc_url: https://docs.tolt.com/errors#payload_too_large
    RateLimited:
      description: The API key exceeded its rate limit
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
        Retry-After:
          $ref: '#/components/headers/Retry-After'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            success: false
            message: Too many requests. Retry after the window resets.
            code: rate_limited
            doc_url: https://docs.tolt.com/errors#rate_limited
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Tolt API key sent as a bearer token.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.