Cactal Server functions API

Inspect a website's server function runs and run its `http` functions on the draft. Visitors call `http` functions with `POST /_framework/server/{name}` on the website itself.

Operations 3

GET /websites/{websiteId}/functions/runs List server function runs #
GET /websites/{websiteId}/functions/runs/{runId} Get a server function run #
POST /websites/{websiteId}/functions/{name}/invoke Run a server function on the draft #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/cactal-ai:cactal-ai-server-functions-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

cactal-ai-server-functions-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Cactal Ai Server functions API
  version: 1.0.0
  description: 'Operations tagged Server functions across 2 of this provider''s published API definitions: openapi.json, cactal-ai-openapi.json. Each path carries the servers of the definition it was published in.'
servers:
- url: https://api.cactal.ai/v1
security:
- apiKey: []
tags:
- name: Server functions
  description: Inspect a website's server function runs and run its `http` functions on the draft. Visitors call `http` functions with `POST /_framework/server/{name}` on the website itself.
paths:
  /websites/{websiteId}/functions/runs:
    get:
      operationId: websiteFunctions.runs.list
      summary: List server function runs
      description: Lists a website's server function runs, newest first, for `http` calls and form submissions alike. Secret values are redacted. Runs are kept for 30 days.
      tags:
      - Server functions
      parameters:
      - name: websiteId
        in: path
        required: true
        schema:
          type: string
          minLength: 1
      - name: name
        in: query
        required: false
        schema:
          description: Only runs of this function.
          type: string
      - name: cursor
        in: query
        required: false
        schema:
          type: string
      - name: limit
        in: query
        required: false
        schema:
          default: 20
          type: integer
          minimum: 1
          maximum: 100
      responses:
        '200':
          description: A page of runs.
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        functionName:
                          type: string
                        trigger:
                          type: string
                          enum:
                          - http
                          - form
                        source:
                          type: string
                          enum:
                          - draft
                          - published
                        triggerId:
                          description: The form submission id a `form` run handled.
                          type:
                          - string
                          - 'null'
                        status:
                          type: string
                          enum:
                          - succeeded
                          - failed
                        errorCode:
                          anyOf:
                          - type: string
                            enum:
                            - not_found
                            - function_error
                            - timeout
                            - limit_exceeded
                            - unavailable
                          - type: 'null'
                        errorMessage:
                          type:
                          - string
                          - 'null'
                        cpuMs:
                          type: number
                        wallMs:
                          type: number
                        queueMs:
                          type: number
                        memoryBytes:
                          type: number
                        createdAt:
                          type: string
                      required:
                      - id
                      - functionName
                      - trigger
                      - source
                      - triggerId
                      - status
                      - errorCode
                      - errorMessage
                      - cpuMs
                      - wallMs
                      - queueMs
                      - memoryBytes
                      - createdAt
                      additionalProperties: false
                  nextCursor:
                    description: Opaque cursor for the next page. Pass it as the `cursor` parameter on the next request. `null` when this is the last page.
                    type:
                    - string
                    - 'null'
                required:
                - items
                - nextCursor
                additionalProperties: false
        '400':
          description: Validation failed. The response `message` names the first invalid field.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceError'
        '401':
          description: Missing, invalid, expired, or revoked API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceError'
        '403':
          description: The authenticated principal lacks the required capability.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceError'
        '404':
          description: The resource does not exist or is outside the principal’s access scope.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceError'
        '429':
          description: Rate limit exceeded. Retry after the number of seconds in the `Retry-After` header.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceError'
      x-cactal-required-capability: websiteFunctions.view
      x-cactal-read-only: true
      x-cactal-destructive: false
      x-cactal-idempotent: true
    servers:
    - url: https://api.cactal.ai/v1
  /websites/{websiteId}/functions/runs/{runId}:
    get:
      operationId: websiteFunctions.runs.get
      summary: Get a server function run
      description: Returns one run with its input, output, console output and outgoing requests. Secret values, in plain and common encoded forms, are redacted.
      tags:
      - Server functions
      parameters:
      - name: websiteId
        in: path
        required: true
        schema:
          type: string
          minLength: 1
      - name: runId
        in: path
        required: true
        schema:
          type: string
          minLength: 1
      responses:
        '200':
          description: The run.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  functionName:
                    type: string
                  trigger:
                    type: string
                    enum:
                    - http
                    - form
                  source:
                    type: string
                    enum:
                    - draft
                    - published
                  triggerId:
                    description: The form submission id a `form` run handled.
                    type:
                    - string
                    - 'null'
                  status:
                    type: string
                    enum:
                    - succeeded
                    - failed
                  errorCode:
                    anyOf:
                    - type: string
                      enum:
                      - not_found
                      - function_error
                      - timeout
                      - limit_exceeded
                      - unavailable
                    - type: 'null'
                  errorMessage:
                    type:
                    - string
                    - 'null'
                  cpuMs:
                    type: number
                  wallMs:
                    type: number
                  queueMs:
                    type: number
                  memoryBytes:
                    type: number
                  createdAt:
                    type: string
                  input:
                    description: The payload as JSON text.
                    type:
                    - string
                    - 'null'
                  output:
                    description: The returned data as JSON text, when the run succeeded.
                    type:
                    - string
                    - 'null'
                  logs:
                    type: array
                    items:
                      type: object
                      properties:
                        level:
                          type: string
                        message:
                          type: string
                      required:
                      - level
                      - message
                      additionalProperties: false
                  requests:
                    type: array
                    items:
                      type: object
                      properties:
                        method:
                          type: string
                        url:
                          type: string
                        status:
                          type: number
                        error:
                          type: string
                        durationMs:
                          type: number
                      required:
                      - method
                      - url
                      - durationMs
                      additionalProperties: false
                required:
                - id
                - functionName
                - trigger
                - source
                - triggerId
                - status
                - errorCode
                - errorMessage
                - cpuMs
                - wallMs
                - queueMs
                - memoryBytes
                - createdAt
                - input
                - output
                - logs
                - requests
                additionalProperties: false
        '400':
          description: Validation failed. The response `message` names the first invalid field.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceError'
        '401':
          description: Missing, invalid, expired, or revoked API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceError'
        '403':
          description: The authenticated principal lacks the required capability.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceError'
        '404':
          description: The resource does not exist or is outside the principal’s access scope.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceError'
        '429':
          description: Rate limit exceeded. Retry after the number of seconds in the `Retry-After` header.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceError'
      x-cactal-required-capability: websiteFunctions.view
      x-cactal-read-only: true
      x-cactal-destructive: false
      x-cactal-idempotent: true
    servers:
    - url: https://api.cactal.ai/v1
  /websites/{websiteId}/functions/{name}/invoke:
    post:
      operationId: websiteFunctions.invoke
      summary: Run a server function on the draft
      description: Runs one of the draft site's `http` server functions with the website's secrets and returns its result, exactly as page code on the draft would receive it. It makes the function's real outgoing requests. Counts toward the plan's monthly calls.
      tags:
      - Server functions
      parameters:
      - name: websiteId
        in: path
        required: true
        schema:
          type: string
          minLength: 1
      - name: name
        in: path
        required: true
        schema:
          type: string
          minLength: 1
          description: An `http` server function.
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                payload:
                  description: The handler's first argument, as JSON.
      responses:
        '200':
          description: 'The run id and the result: `{ ok: true, data }` or `{ ok: false, error }`.'
          content:
            application/json:
              schema:
                type: object
                properties:
                  runId:
                    type: string
                  result:
                    anyOf:
                    - type: object
                      properties:
                        ok:
                          type: boolean
                          const: true
                        data: {}
                      required:
                      - ok
                      - data
                      additionalProperties: false
                    - type: object
                      properties:
                        ok:
                          type: boolean
                          const: false
                        error:
                          type: object
                          properties:
                            code:
                              type: string
                              enum:
                              - not_found
                              - function_error
                              - timeout
                              - limit_exceeded
                              - unavailable
                            message:
                              type: string
                          required:
                          - code
                          - message
                          additionalProperties: false
                      required:
                      - ok
                      - error
                      additionalProperties: false
                required:
                - runId
                - result
                additionalProperties: false
        '400':
          description: Validation failed. The response `message` names the first invalid field.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceError'
        '401':
          description: Missing, invalid, expired, or revoked API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceError'
        '403':
          description: The authenticated principal lacks the required capability.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceError'
        '404':
          description: The resource does not exist or is outside the principal’s access scope.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceError'
        '429':
          description: Rate limit exceeded. Retry after the number of seconds in the `Retry-After` header.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceError'
      x-cactal-required-capability: websiteFunctions.invoke
      x-cactal-read-only: false
      x-cactal-destructive: true
      x-cactal-idempotent: false
    servers:
    - url: https://api.cactal.ai/v1
components:
  schemas:
    ServiceError:
      type: object
      required:
      - kind
      - message
      description: Canonical error body returned by every non-2xx response. Extra fields carry error-specific details.
      properties:
        kind:
          type: string
          enum:
          - validation
          - unauthorized
          - forbidden
          - not_found
          - conflict
          - rate_limited
          - internal
          description: Stable, machine-readable error category.
        message:
          type: string
          description: Human-readable explanation of the failure.
        suggestion:
          type: string
          description: What to do next when the failure has a known fix; may name the exact operation to call.
        validValues:
          type: array
          items:
            type: string
          description: The acceptable values for the failing field, when the set is closed.
      additionalProperties: true
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: Cactal API key. Create one in the dashboard or via `POST /apiKeys`. The plaintext key is shown once at creation.
x-refined-from:
- openapi.json
- cactal-ai-openapi.json