Zavu Functions API

The Functions API from Zavu — 12 operation(s) for functions.

GitHub OpenAPI
Pull this API's OpenAPI, operations, scores and pricing into your own code or AI agent with a free APIs.io key — sign in with GitHub, Google or LinkedIn. No form to fill in; signing in shares your email address with us (Privacy).

Operations 17

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

GET /v1/functions/event-types List event types a function can subscribe to · List function event types #
Ask an LLM
“Which event types can I subscribe a function trigger to?”
“What event types exist for function triggers?”
Tell an agent
List the event types a function trigger can subscribe to.
Show every event type a function can be triggered by.
GET /v1/functions/{functionId}/triggers List a function's triggers · List function triggers #
Ask an LLM
“Which triggers are subscribed to a given function?”
“Can I see all the event subscriptions on one function?”
Tell an agent
List the triggers on function {functionId}.
Show every trigger subscribed to function {functionId}.
POST /v1/functions/{functionId}/triggers Subscribe a function to event types · Create function triggers #
Ask an LLM
“How do I make a function react to incoming events?”
“Can I scope a function's event subscriptions to certain senders?”
Tell an agent
Subscribe function {functionId} to event types {eventTypes} for senders {senderIds}.
Create triggers on {functionId} for {eventTypes} from {senderIds}.
PATCH /v1/functions/triggers/{triggerId} Enable or disable a function trigger · Enable or disable a trigger #
Ask an LLM
“Can I temporarily pause a function trigger without deleting it?”
“How do I turn a function trigger on or off?”
Tell an agent
Set trigger {triggerId} active to {active}.
Enable function trigger {triggerId} if {active} is true.
DELETE /v1/functions/triggers/{triggerId} Delete a function trigger · Delete a trigger #
Ask an LLM
“How do I stop a function from reacting to a trigger?”
“Can I remove a single trigger from a function?”
Tell an agent destructive · confirm first
Delete trigger {triggerId}.
Remove function trigger {triggerId}.
GET /v1/functions/{functionId}/deployments List a function's deployment history · List function deployments #
Ask an LLM
“What deployments has a function had?”
“Can I see the deployment history of a function, newest first?”
Tell an agent
List the deployments of function {functionId}.
Show the last {limit} deployments of {functionId}.
POST /v1/functions/{functionId}/rollback Roll back a function to a previous deployment · Roll back to a previous deployment #
Ask an LLM
“How do I revert a function to an earlier version?”
“Does rolling back a function also roll back its secrets?”
Tell an agent
Roll back function {functionId} to deployment {deploymentId}.
Revert {functionId} to the source of {deploymentId}.
POST /v1/functions Create a Zavu function · Create function #
Ask an LLM
“How do I create a new Zavu function?”
“Is an API key automatically provisioned when I create a function?”
Tell an agent
Create a function {slug} named {name}.
Create function {slug} with runtime {runtime} and source code {sourceCode}.
GET /v1/functions/{functionId} Get a function · Get function #
Ask an LLM
“What is the status of a function?”
“Can I look up a function by its ID?”
Tell an agent
Get function {functionId}.
Show the details of function {functionId}.
PATCH /v1/functions/{functionId} Update a function's draft source code · Update function draft #
Ask an LLM
“Can I change a function's source code without redeploying it?”
“How do I edit the draft of a function?”
Tell an agent
Update the draft of function {functionId} with source code {sourceCode}.
Replace the draft dependencies of {functionId} with {dependencies}.
DELETE /v1/functions/{functionId} Delete a function and everything it owns · Delete function #
Ask an LLM
“How do I permanently delete a function?”
“Does deleting a function also tear down its triggers and secrets?”
Tell an agent destructive · confirm first
Delete function {functionId}.
Permanently remove function {functionId} and its triggers, secrets and deployment history.
POST /v1/functions/{functionId}/deploy Deploy a function · Deploy function #
Ask an LLM
“How do I publish a function's draft?”
“Can I deploy a function with new source code in the same call?”
Tell an agent
Deploy function {functionId}.
Deploy {functionId} with source code {sourceCode} and dependencies {dependencies}.
GET /v1/functions/deployments/{deploymentId} Check a function deployment's status · Get deployment #
Ask an LLM
“Has my function deployment finished?”
“How do I poll a function deployment until it is active?”
Tell an agent
Get deployment {deploymentId}.
Check the status of function deployment {deploymentId}.
GET /v1/functions/{functionId}/secrets List a function's secret keys · List function secrets #
Ask an LLM
“Which secret keys are set on a function?”
“Can I see the secret keys a function has without seeing their values?”
Tell an agent
List the secret keys on function {functionId}.
Show every secret key set on {functionId}.
PUT /v1/functions/{functionId}/secrets/{key} Set a function secret · Set function secret #
Ask an LLM
“How do I add a secret to a function?”
“Do function secrets need to follow an uppercase env-var naming pattern?”
Tell an agent
Set secret {key} on function {functionId} to {value}.
Add {value} as secret {key} to {functionId}.
DELETE /v1/functions/{functionId}/secrets/{key} Remove a function secret · Unset function secret #
Ask an LLM
“How do I remove a secret from a function?”
“Does removing a function secret take effect immediately?”
Tell an agent destructive · confirm first
Unset secret {key} on function {functionId}.
Remove {key} from the secrets of {functionId}.
GET /v1/functions/{functionId}/logs Tail a function's invocation logs · Tail function logs #
Ask an LLM
“How do I see what a function has logged during its invocations?”
“Can I filter a function's logs by a pattern?”
Tell an agent
Tail the logs of function {functionId}.
Show {limit} logs of {functionId} matching {filterPattern}.

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/zavu:zavu-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. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

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

OpenAPI Specification

zavu-functions-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Zavu Unified Messaging Layer Functions API
  version: 0.2.0
  description: Unified multi-channel messaging API for Zavu.
servers:
- url: https://api.zavu.dev
security:
- bearerAuth: []
tags:
- name: Functions
paths:
  /v1/functions/event-types:
    get:
      summary: List function event types
      description: List the event types a function trigger can subscribe to.
      operationId: listFunctionEventTypes
      tags:
      - Functions
      responses:
        '200':
          description: Supported event types.
          content:
            application/json:
              schema:
                type: object
                required:
                - events
                properties:
                  events:
                    type: array
                    items:
                      type: string
                    example:
                    - message.inbound
                    - message.delivered
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/functions/{functionId}/triggers:
    get:
      summary: List function triggers
      operationId: listFunctionTriggers
      tags:
      - Functions
      parameters:
      - $ref: '#/components/parameters/FunctionIdParam'
      responses:
        '200':
          description: Triggers for the function.
          content:
            application/json:
              schema:
                type: object
                required:
                - triggers
                properties:
                  triggers:
                    type: array
                    items:
                      $ref: '#/components/schemas/FunctionTrigger'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Function not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
    post:
      summary: Create function triggers
      description: Subscribe a function to one or more event types, optionally scoped to specific senders. Provide eventTypes and senderIds (use null in senderIds for all senders); a trigger is created for each event type and sender combination.
      operationId: createFunctionTriggers
      tags:
      - Functions
      parameters:
      - $ref: '#/components/parameters/FunctionIdParam'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - eventTypes
              - senderIds
              properties:
                eventTypes:
                  type: array
                  items:
                    type: string
                  description: Event types to subscribe to.
                senderIds:
                  type: array
                  items:
                    type:
                    - string
                    - 'null'
                  description: Senders to scope the triggers to. Use null for all senders.
            example:
              eventTypes:
              - message.inbound
              senderIds:
              - null
      responses:
        '201':
          description: Triggers created.
          content:
            application/json:
              schema:
                type: object
                required:
                - added
                - skipped
                - triggers
                properties:
                  added:
                    type: integer
                  skipped:
                    type: integer
                    description: Number of triggers that already existed.
                  triggers:
                    type: array
                    items:
                      $ref: '#/components/schemas/FunctionTrigger'
        '400':
          description: Invalid request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Function not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/functions/triggers/{triggerId}:
    patch:
      summary: Enable or disable a trigger
      operationId: updateFunctionTrigger
      tags:
      - Functions
      parameters:
      - name: triggerId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - active
              properties:
                active:
                  type: boolean
      responses:
        '200':
          description: Trigger updated.
          content:
            application/json:
              schema:
                type: object
                required:
                - ok
                - active
                properties:
                  ok:
                    type: boolean
                  active:
                    type: boolean
        '400':
          description: Invalid request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Trigger not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
    delete:
      summary: Delete a trigger
      operationId: deleteFunctionTrigger
      tags:
      - Functions
      parameters:
      - name: triggerId
        in: path
        required: true
        schema:
          type: string
      responses:
        '204':
          description: Trigger deleted.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Trigger not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/functions/{functionId}/deployments:
    get:
      summary: List function deployments
      description: List a function's deployment history, newest first. Source code is omitted; fetch a single deployment via GET /v1/functions/deployments/{deploymentId} for full details.
      operationId: listFunctionDeployments
      tags:
      - Functions
      parameters:
      - $ref: '#/components/parameters/FunctionIdParam'
      - name: limit
        in: query
        schema:
          type: integer
          default: 20
          maximum: 100
      responses:
        '200':
          description: Deployment history.
          content:
            application/json:
              schema:
                type: object
                required:
                - deployments
                properties:
                  deployments:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        version:
                          type: integer
                        status:
                          $ref: '#/components/schemas/FunctionDeploymentStatus'
                        bundleSizeBytes:
                          type:
                          - integer
                          - 'null'
                        errorMessage:
                          type:
                          - string
                          - 'null'
                        isActive:
                          type: boolean
                        deployedAt:
                          type:
                          - string
                          - 'null'
                          format: date-time
                        createdAt:
                          type: string
                          format: date-time
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Function not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/functions/{functionId}/rollback:
    post:
      summary: Roll back to a previous deployment
      description: Re-deploy a previous version by copying its source, dependencies, and runtime pin onto the function's draft, then deploying. Returns immediately with a deployment ID — poll GET /v1/functions/deployments/{deploymentId} until status is active or failed. Secrets are not rolled back.
      operationId: rollbackFunction
      tags:
      - Functions
      parameters:
      - $ref: '#/components/parameters/FunctionIdParam'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - deploymentId
              properties:
                deploymentId:
                  type: string
                  description: ID of the deployment to roll back to.
            example:
              deploymentId: fnd_abc123
      responses:
        '202':
          description: Rollback deployment queued.
          content:
            application/json:
              schema:
                type: object
                required:
                - deployment
                properties:
                  deployment:
                    $ref: '#/components/schemas/FunctionDeployment'
                  rolledBackToVersion:
                    type: integer
                  previousDraft:
                    type:
                    - object
                    - 'null'
                    description: The draft that was replaced, so a UI can offer to restore it.
        '400':
          description: Invalid request or function in a non-deployable state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Function or deployment not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/functions:
    post:
      summary: Create function
      description: 'Create a new Zavu Function. The function starts in `draft` status. A dedicated API key is auto-provisioned and injected as the `ZAVU_API_KEY` secret so the function can call back into the Zavu API without manual setup.


        Provide `sourceCode` to seed the draft. Call `POST /v1/functions/{functionId}/deploy` afterwards to publish.'
      operationId: createFunction
      tags:
      - Functions
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FunctionCreateRequest'
            example:
              slug: order-bot
              name: Order Bot
              description: Replies to order status questions on WhatsApp.
              sourceCode: "import { defineFunction } from '@zavu/functions';\n\nexport default defineFunction(async (event, ctx) => {\n  ctx.log('received', event.type);\n});\n"
              dependencies:
                openai: ^4.20.0
      responses:
        '201':
          description: Function created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ZavuFunctionResponse'
        '400':
          description: Invalid request (e.g. duplicate slug, invalid dependencies).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/functions/{functionId}:
    get:
      summary: Get function
      operationId: getFunction
      tags:
      - Functions
      parameters:
      - $ref: '#/components/parameters/FunctionIdParam'
      responses:
        '200':
          description: Function details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ZavuFunctionResponse'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Function not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
    patch:
      summary: Update function draft
      description: Update the draft source code and/or dependency map without triggering a build. Visible in the dashboard immediately, but the live (deployed) function does not change until `POST /v1/functions/{functionId}/deploy` runs.
      operationId: updateFunctionDraft
      tags:
      - Functions
      parameters:
      - $ref: '#/components/parameters/FunctionIdParam'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FunctionDeployRequest'
      responses:
        '200':
          description: Draft updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ZavuFunctionResponse'
        '400':
          description: No fields provided.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Function not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
    delete:
      summary: Delete function
      description: 'Permanently delete a function and cascade: triggers, secrets, deployment history, managed agents+tools, and revoke the auto-provisioned API key. The AWS Lambda + log group are torn down asynchronously.'
      operationId: deleteFunction
      tags:
      - Functions
      parameters:
      - $ref: '#/components/parameters/FunctionIdParam'
      responses:
        '200':
          description: Function deleted.
          content:
            application/json:
              schema:
                type: object
                required:
                - deleted
                properties:
                  deleted:
                    type: boolean
                  name:
                    type: string
                  slug:
                    type: string
        '400':
          description: Cannot delete while a deployment is in progress.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Function not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/functions/{functionId}/deploy:
    post:
      summary: Deploy function
      description: Publish the function. If `sourceCode` or `dependencies` are provided in the body, they replace the current draft before deployment. Returns immediately with a deployment ID — poll `GET /v1/functions/deployments/{deploymentId}` until status is `active` or `failed`.
      operationId: deployFunction
      tags:
      - Functions
      parameters:
      - $ref: '#/components/parameters/FunctionIdParam'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FunctionDeployRequest'
      responses:
        '202':
          description: Deployment queued.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FunctionDeploymentResponse'
        '400':
          description: Invalid request or function in a non-deployable state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Function not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/functions/deployments/{deploymentId}:
    get:
      summary: Get deployment
      description: Fetch a deployment to poll its status during a deploy.
      operationId: getFunctionDeployment
      tags:
      - Functions
      parameters:
      - $ref: '#/components/parameters/FunctionDeploymentIdParam'
      responses:
        '200':
          description: Deployment details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FunctionDeploymentResponse'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Deployment not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/functions/{functionId}/secrets:
    get:
      summary: List function secrets
      description: Lists every secret key set on the function. Plaintext is NEVER returned — only the last 4 characters of each value, for visual confirmation.
      operationId: listFunctionSecrets
      tags:
      - Functions
      parameters:
      - $ref: '#/components/parameters/FunctionIdParam'
      responses:
        '200':
          description: Secrets list.
          content:
            application/json:
              schema:
                type: object
                required:
                - secrets
                properties:
                  secrets:
                    type: array
                    items:
                      type: object
                      required:
                      - id
                      - key
                      - valueLast4
                      properties:
                        id:
                          type: string
                        key:
                          type: string
                        valueLast4:
                          type: string
                        syncedToAws:
                          type: boolean
                        createdAt:
                          type: number
                        updatedAt:
                          type: number
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/functions/{functionId}/secrets/{key}:
    put:
      summary: Set function secret
      description: Create or update a secret on a function. Marks the function out-of-sync; the next `POST /deploy` re-publishes the Lambda with the new env. Keys must match `[A-Z_][A-Z0-9_]*` (uppercase env-var style) and cannot start with reserved prefixes (AWS_, LAMBDA_, etc).
      operationId: setFunctionSecret
      tags:
      - Functions
      parameters:
      - $ref: '#/components/parameters/FunctionIdParam'
      - name: key
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - value
              properties:
                value:
                  type: string
      responses:
        '200':
          description: Secret updated.
          content:
            application/json:
              schema:
                type: object
        '201':
          description: Secret created.
          content:
            application/json:
              schema:
                type: object
        '400':
          description: Invalid key or value.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
    delete:
      summary: Unset function secret
      description: Remove a secret from a function. Doesn't take effect on the running Lambda until the next deploy.
      operationId: unsetFunctionSecret
      tags:
      - Functions
      parameters:
      - $ref: '#/components/parameters/FunctionIdParam'
      - name: key
        in: path
        required: true
        schema:
          type: string
      responses:
        '204':
          description: Secret removed.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Secret not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/functions/{functionId}/logs:
    get:
      summary: Tail function logs
      description: Fetch invocation logs for a function. Logs are paginated via `nextToken`. Pass `startTime` / `endTime` (Unix epoch milliseconds) to bound the window, or `filterPattern` to filter messages.
      operationId: tailFunctionLogs
      tags:
      - Functions
      parameters:
      - $ref: '#/components/parameters/FunctionIdParam'
      - name: limit
        in: query
        schema:
          type: integer
          default: 100
          minimum: 1
          maximum: 1000
      - name: nextToken
        in: query
        schema:
          type: string
      - name: startTime
        in: query
        description: Start of the log window in Unix epoch milliseconds.
        schema:
          type: integer
          format: int64
      - name: endTime
        in: query
        description: End of the log window in Unix epoch milliseconds.
        schema:
          type: integer
          format: int64
      - name: filterPattern
        in: query
        schema:
          type: string
      responses:
        '200':
          description: Log events.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FunctionLogsResponse'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Function not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
components:
  schemas:
    FunctionDeploymentStatus:
      type: string
      description: Stage of a function deployment.
      enum:
      - pending
      - bundling
      - uploading
      - publishing
      - active
      - failed
      - superseded
    FunctionLogsResponse:
      type: object
      required:
      - events
      properties:
        events:
          type: array
          items:
            $ref: '#/components/schemas/FunctionLogEvent'
        nextToken:
          type:
          - string
          - 'null'
          description: Pass to the next request to fetch the following page of logs.
    FunctionCreateRequest:
      type: object
      required:
      - slug
      - name
      properties:
        slug:
          type: string
          description: URL-safe identifier (lowercase, digits, hyphens). Must be unique per project.
          minLength: 1
          maxLength: 50
          example: order-bot
        name:
          type: string
          maxLength: 80
          example: Order Bot
        description:
          type: string
          maxLength: 280
        runtime:
          $ref: '#/components/schemas/ZavuFunctionRuntime'
        timeoutSec:
          type: integer
          minimum: 1
          maximum: 30
          default: 10
        memoryMb:
          type: integer
          enum:
          - 128
          - 256
          - 512
          - 1024
          default: 256
        httpEnabled:
          type: boolean
          default: false
          description: Whether to expose a public HTTPS URL for this function.
        sourceCode:
          type: string
          description: TypeScript source code for the function entry point (max ~900KB).
          maxLength: 900000
        dependencies:
          type: object
          additionalProperties:
            type: string
          description: npm dependencies. Keys are package names, values are semver ranges.
          example:
            openai: ^4.20.0
    ZavuFunctionStatus:
      type: string
      description: Lifecycle status of a Zavu Function.
      enum:
      - draft
      - bundling
      - deploying
      - active
      - failed
      - disabled
    ZavuFunction:
      type: object
      description: A Zavu Function — user-supplied TypeScript that runs in Zavu Cloud and reacts to messaging events or HTTP requests.
      required:
      - id
      - slug
      - name
      - runtime
      - status
      - timeoutSec
      - memoryMb
      - httpEnabled
      - dependencies
      - createdAt
      - updatedAt
      properties:
        id:
          type: string
          example: fn_abc123
        slug:
          type: string
          description: URL-safe identifier, unique per project.
          example: order-bot
        name:
          type: string
          example: Order Bot
        description:
          type:
          - string
          - 'null'
        runtime:
          $ref: '#/components/schemas/ZavuFunctionRuntime'
        status:
          $ref: '#/components/schemas/ZavuFunctionStatus'
        timeoutSec:
          type: integer
          description: Per-invocation timeout in seconds.
          example: 10
        memoryMb:
          type: integer
          description: Memory allocation in MB.
          example: 256
        httpEnabled:
          type: boolean
          description: Whether the function can be invoked over HTTPS via its public URL.
        publicUrl:
          type:
          - string
          - 'null'
          format: uri
          description: HTTPS endpoint when httpEnabled is true.
        dependencies:
          type: object
          additionalProperties:
            type: string
          description: npm dependencies installed in the function bundle. Keys are package names, values are semver ranges.
          example:
            openai: ^4.20.0
        activeDeploymentId:
          type:
          - string
          - 'null'
          description: ID of the deployment currently serving traffic.
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    ZavuFunctionRuntime:
      type: string
      description: Runtime the function is deployed on.
      enum:
      - nodejs24
    FunctionTrigger:
      type: object
      description: A subscription that runs a Zavu Function when a messaging event fires.
      required:
      - id
      - functionId
      - eventType
      - active
      - createdAt
      - updatedAt
      properties:
        id:
          type: string
        functionId:
          type: string
        eventType:
          type: string
          description: Event type that fires the function. See GET /v1/functions/event-types for the supported list.
        senderId:
          type:
          - string
          - 'null'
          description: Restrict the trigger to a single sender. Null means all senders in the project.
        active:
          type: boolean
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    FunctionDeployRequest:
      type: object
      description: Optional source/dependencies update applied before deploying. Omit both fields to redeploy the current draft as-is.
      properties:
        sourceCode:
          type: string
          description: New source code to publish (replaces the draft).
          maxLength: 900000
        dependencies:
          type: object
          additionalProperties:
            type: string
          description: New dependency map (replaces existing dependencies).
    ZavuFunctionResponse:
      type: object
      required:
      - function
      properties:
        function:
          $ref: '#/components/schemas/ZavuFunction'
    FunctionDeploymentResponse:
      type: object
      required:
      - deployment
      properties:
        deployment:
          $ref: '#/components/schemas/FunctionDeployment'
    FunctionLogEvent:
      type: object
      required:
      - timestamp
      - message
      properties:
        timestamp:
          type: string
          format: date-time
        message:
          type: string
    FunctionDeployment:
      type: object
      required:
      - id
      - functionId
      - version
      - status
      - createdAt
      properties:
        id:
          type: string
          example: fnd_abc123
        functionId:
          type: string
        version:
          type: integer
          description: Monotonically increasing deployment version, starting at 1.
        status:
          $ref: '#/components/schemas/FunctionDeploymentStatus'
        sourceCodeBytes:
          type:
          - integer
          - 'null'
        bundleBytes:
          type:
          - integer
          - 'null'
        errorMessage:
          type:
          - string
          - 'null'
          description: Failure reason when status is 'failed'.
        deployedAt:
          type:
          - string
          - 'null'
          format: date-time
        createdAt:
          type: string
          format: date-time
    Error:
      type: object
      required:
      - code
      - message
      properties:
        code:
          type: string
          example: invalid_request
        message:
          type: string
          example: Phone number is invalid
        details:
          type: object
          additionalProperties: true
  parameters:
    FunctionDeploymentIdParam:
      name: deploymentId
      in: path
      required: true
      description: Function deployment ID.
      schema:
        type: string
    FunctionIdParam:
      name: functionId
      in: path
      required: true
      description: Zavu Function ID.
      schema:
        type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT