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

# Generate proof of work

> Solves the per-request proof of work and returns the value for the `x-kpsdk-cd` header.
Every protected request needs a fresh one; never reuse a `cd`.

`st` and `ct` come from the session you established with the challenge payload. `fc` is the
site's base64 feature configuration when the page provides one; leave it out otherwise and
Roolink uses Kasada's defaults. Work stops after ten seconds with `504`.
Free: doesn't count against your Kasada plan, though the key still needs an active plan or balance.




## OpenAPI

````yaml api-reference/openapi/kasada.yaml POST /api/v1/cd
openapi: 3.1.0
info:
  title: Roolink Kasada API
  version: 1.0.0
  description: >
    Generates the payloads Kasada expects from a browser: the challenge payload
    and `x-kpsdk-*`

    headers for the `/tl` request, a fresh `x-kpsdk-cd` proof of work for each
    protected request,

    and the `x-is-human` header for endpoints protected by Vercel BotID.


    Every request is `POST` with a JSON body and returns JSON. Errors carry
    `{"code", "error"}`.
servers:
  - url: https://ksd.roolink.io
security:
  - ApiKey: []
paths:
  /api/v1/cd:
    post:
      summary: Generate proof of work
      description: >
        Solves the per-request proof of work and returns the value for the
        `x-kpsdk-cd` header.

        Every protected request needs a fresh one; never reuse a `cd`.


        `st` and `ct` come from the session you established with the challenge
        payload. `fc` is the

        site's base64 feature configuration when the page provides one; leave it
        out otherwise and

        Roolink uses Kasada's defaults. Work stops after ten seconds with `504`.

        Free: doesn't count against your Kasada plan, though the key still needs
        an active plan or balance.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - st
                - ct
                - domain
              properties:
                st:
                  type: integer
                  format: int64
                  description: >-
                    The session's `st` value, a millisecond timestamp no later
                    than the current time.
                ct:
                  type: string
                  description: The session's `x-kpsdk-ct` value. At least 16 bytes.
                fc:
                  type: string
                  description: >-
                    Optional base64 feature configuration from the page. Omit or
                    send an empty string when there is none.
                domain:
                  type: string
                  description: >-
                    The exact hostname of the protected site, for example
                    `www.example.com`.
            example:
              st: 1788893087778
              ct: 0aGzYc9d3d1b8f6f4e0e2d7c1b9a5f3e
              fc: ''
              domain: www.example.com
      responses:
        '200':
          description: Proof of work solved.
          content:
            application/json:
              schema:
                type: object
                required:
                  - payload
                properties:
                  payload:
                    type: string
                    description: >-
                      The `x-kpsdk-cd` header value, a serialised JSON string.
                      Send it as is.
        '400':
          $ref: '#/components/responses/InvalidJson'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '413':
          $ref: '#/components/responses/TooLarge'
        '415':
          $ref: '#/components/responses/UnsupportedMedia'
        '422':
          description: >-
            `invalid_request`: `st` is not a valid timestamp, `ct` is too short,
            `fc` is not valid, or the domain is not supported.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/Quota'
        '503':
          $ref: '#/components/responses/Overloaded'
        '504':
          description: >-
            `pow_timeout`: the proof of work exceeded the ten-second limit.
            Retry once.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  responses:
    InvalidJson:
      description: >-
        `invalid_json`: the body is not one JSON object, or contains a field
        this endpoint does not accept.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: The `x-api-key` header is missing or the key is invalid.
    TooLarge:
      description: '`body_too_large`: the request body exceeds 8 MiB.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    UnsupportedMedia:
      description: '`unsupported_media_type`: `Content-Type` must be `application/json`.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Quota:
      description: Kasada is not enabled on this key or its quota is exhausted.
    Overloaded:
      description: >-
        `overloaded`: the service is at capacity. Retry after the `Retry-After`
        delay.
      headers:
        Retry-After:
          schema:
            type: integer
          description: Seconds to wait before retrying.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      required:
        - code
        - error
      properties:
        code:
          type: string
          description: Machine-readable error code.
        error:
          type: string
          description: Human-readable message.
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: x-api-key

````

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