Neuron Approvals API

Human-in-the-loop approvals — request approve/reject over WhatsApp, get the decision back via a pluggable callback scheme

GitHub OpenAPI

Operations 5

POST /approvals Create an approval request #
GET /approvals List approval requests #
GET /approvals/{id} Get an approval request #
POST /approvals/{id}/respond Approve or reject an approval #
POST /approvals/{id}/cancel Cancel a pending approval #

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/neuron-ng:neuron-ng-approvals-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

neuron-ng-approvals-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Neuron Approvals API
  version: 1.0.0
  description: 'API reference for Neuron — the AI-powered WhatsApp chatbot platform.


    Neuron lets you build intelligent chatbots with tool integrations, knowledge bases, and human-in-the-loop monitoring.


    ## Authentication


    Most endpoints require a JWT bearer token obtained from `POST /auth/login`.


    Bot API endpoints use API keys prefixed with `nrn_`.


    The **Social API** (`/social`) is organization-scoped — authenticate with an **account token** (`nrn_acc_`, from Dashboard → Settings → Account Tokens). Bot API keys are also accepted for backward compatibility but are legacy for this API.


    ## Response Format


    All responses follow the envelope: `{ success: boolean, data?: any, error?: { message, code } }`'
servers:
- url: /api/v1
  description: API v1
tags:
- name: Approvals
  description: Human-in-the-loop approvals — request approve/reject over WhatsApp, get the decision back via a pluggable callback scheme
paths:
  /approvals:
    post:
      tags:
      - Approvals
      summary: Create an approval request
      security:
      - ApiKeyAuth: []
      description: 'Ask a human to approve or reject an action over WhatsApp, then receive the decision back through a pluggable callback scheme.


        The recipient replies (`approve` / `reject` / `reject: `, or by quoting the message). The decision is delivered via the `callback.delivery` scheme, and — when `callback.await` is true — also returned inline on this request.


        **Callback schemes**

        - `response.schemes` (how a reply becomes a decision): `interactive` · `keyword` · `code` · `llm` (ordered fallback).

        - `delivery.scheme` (how the decision reaches you): `webhook_signed` (HMAC) · `webhook_simple` (URL-as-secret) · `neuron_message` · `neuron_tool` · `none`.


        **Example (signed webhook):**

        ```bash

        curl -X POST https://api.neuron.ng/api/v1/approvals \

        -H "Authorization: Bearer nrn_your_api_key" \

        -H "Content-Type: application/json" \

        -d ''{

        "to": "2348012345678",

        "prompt": "Approve refund of ₦45,000 for order #1042?",

        "callback": {

        "response": { "schemes": ["keyword"] },

        "delivery": { "scheme": "webhook_signed", "config": { "url": "https://your-app.com/hooks/approvals", "secret": "whsec_..." } }

        },

        "metadata": { "orderId": "1042" },

        "idempotencyKey": "refund-1042"

        }''

        ```


        **Response (202 — pending):**

        ```json

        { "success": true, "data": { "approvalId": "b1f...", "status": "pending", "expiresAt": "2024-03-16T10:30:00Z" } }

        ```


        **Callback body (approval.resolved):** `{ "event": "approval.resolved", "data": { "approvalId", "decision", "reason", "responder", "metadata", ... } }` — `webhook_signed` includes header `X-Neuron-Signature: sha256=...`.'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
              - to
              - prompt
              - callback
              properties:
                to:
                  type: string
                  description: Recipient phone number (digits/E.164) or WhatsApp group JID
                prompt:
                  type: string
                  description: The approval question shown to the human
                context:
                  type: string
                  description: Optional long-form details — stored in a shareable Neuron Note and linked from the WhatsApp message (also auto-created when the prompt is very long)
                channelId:
                  type: string
                  format: uuid
                  description: WhatsApp channel to send from (falls back to load balancer / bot primary)
                renderMode:
                  type: string
                  enum:
                  - text
                  - buttons
                  description: How the prompt is rendered (Baileys renders text; buttons require a Meta channel)
                options:
                  type: array
                  description: Custom decision options (defaults to Approve/Reject)
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                      label:
                        type: string
                      decision:
                        type: string
                        enum:
                        - approve
                        - reject
                      requiresReason:
                        type: boolean
                callback:
                  type: object
                  required:
                  - delivery
                  properties:
                    response:
                      type: object
                      properties:
                        schemes:
                          type: array
                          items:
                            type: string
                            enum:
                            - interactive
                            - keyword
                            - code
                            - llm
                        code:
                          type:
                          - string
                          - 'null'
                          description: One-time confirmation code (enables the 'code' scheme)
                    delivery:
                      type: object
                      required:
                      - scheme
                      properties:
                        scheme:
                          type: string
                          enum:
                          - webhook_signed
                          - webhook_simple
                          - neuron_message
                          - neuron_tool
                          - none
                        config:
                          type: object
                          description: 'Scheme-specific: {url,secret} or {webhookId}; {targetJid,channelId}; {toolId}; {method}'
                    await:
                      type: boolean
                      description: Hold the request until resolved (long-poll)
                    awaitTimeoutSec:
                      type: integer
                      minimum: 1
                      maximum: 60
                expiresInSeconds:
                  type: integer
                  description: Time to live (default 86400, clamped 60–604800)
                metadata:
                  type: object
                  description: Opaque data echoed back verbatim in the callback
                idempotencyKey:
                  type: string
                  description: Caller-supplied dedupe key (returns the existing approval on repeat)
        required: true
      responses:
        '202':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      operationId: postApprovals
      x-operation-id-source: derived
    get:
      tags:
      - Approvals
      summary: List approval requests
      security:
      - ApiKeyAuth: []
      description: Paginated list of approvals for the org. Filter by `status` (pending/approved/rejected/expired/cancelled) and `channelId`.
      parameters:
      - name: status
        in: query
        required: false
        schema:
          type: string
      - name: channelId
        in: query
        required: false
        schema:
          type: string
          format: uuid
      - name: page
        in: query
        required: false
        schema:
          type: integer
      - name: limit
        in: query
        required: false
        schema:
          type: integer
      responses:
        '200':
          description: Paginated list
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      data:
                        type: array
                        items:
                          type: object
                      total:
                        type: integer
                      page:
                        type: integer
                      limit:
                        type: integer
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      operationId: getApprovals
      x-operation-id-source: derived
  /approvals/{id}:
    get:
      tags:
      - Approvals
      summary: Get an approval request
      security:
      - ApiKeyAuth: []
      description: Fetch a single approval. Pass `?wait=N` (1–60s) to long-poll until it resolves — the synchronous companion to `callback.await`.
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: wait
        in: query
        required: false
        schema:
          type: integer
        description: Seconds to long-poll for resolution (1–60)
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      operationId: getApprovalsById
      x-operation-id-source: derived
  /approvals/{id}/respond:
    post:
      tags:
      - Approvals
      summary: Approve or reject an approval
      security:
      - ApiKeyAuth: []
      description: 'Programmatically resolve a pending approval (the decision surface for MCP/dashboard operators, as an alternative to replying on WhatsApp). Fires the configured callback and posts the outcome to the chat. Exactly-once: the first responder (here or on WhatsApp) wins; a resolved request returns 410.'
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
              - decision
              properties:
                decision:
                  type: string
                  enum:
                  - approve
                  - reject
                reason:
                  type: string
                  description: Optional reason (recommended for rejections)
                responderName:
                  type: string
                  description: Optional display name of the operator
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      operationId: postApprovalsByIdRespond
      x-operation-id-source: derived
  /approvals/{id}/cancel:
    post:
      tags:
      - Approvals
      summary: Cancel a pending approval
      security:
      - ApiKeyAuth: []
      description: Cancel a still-pending approval (e.g. the upstream action was aborted). Fires the `approval.cancelled` callback.
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                reason:
                  type: string
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      operationId: postApprovalsByIdCancel
      x-operation-id-source: derived
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          properties:
            message:
              type: string
            code:
              type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT access token from POST /auth/login
    ApiKeyAuth:
      type: http
      scheme: bearer
      description: Bot API key (nrn_xxx) from bot API keys management
    AccountTokenAuth:
      type: http
      scheme: bearer
      description: Account token (nrn_acc_xxx) from Dashboard > Settings > Account Tokens