openapi: 3.1.0 info: title: NabaAgent API version: 1.0.0 description: | Workspace-scoped automation API. Authenticate with a Sanctum bearer token and optionally select a workspace with `X-Workspace` (slug or UUID). Errors use RFC 9457 problem details. servers: - url: http://localhost:8000/api/v1 security: - bearerAuth: [] paths: /workflows: get: summary: List workflows parameters: - $ref: '#/components/parameters/Workspace' - name: search in: query schema: { type: string } - name: status in: query schema: { type: string, enum: [draft, published, archived] } - name: per_page in: query schema: { type: integer, minimum: 1, maximum: 100, default: 25 } - name: cursor in: query schema: { type: string } responses: '200': description: Cursor-paginated workflows content: application/json: schema: type: object properties: data: { type: array, items: { $ref: '#/components/schemas/Workflow' } } links: { type: object, additionalProperties: { type: [string, "null"] } } meta: { $ref: '#/components/schemas/CursorMeta' } /workflows/{workflow}/run: post: summary: Trigger a workflow parameters: - $ref: '#/components/parameters/Workspace' - name: workflow in: path required: true schema: { type: string, format: uuid } requestBody: required: false content: application/json: schema: type: object properties: input: { type: object, additionalProperties: true } idempotency_key: { type: string, maxLength: 120 } responses: '200': description: Execution completed synchronously content: application/json: schema: type: object properties: data: { $ref: '#/components/schemas/Execution' } '202': description: Execution queued content: application/json: schema: type: object properties: data: { $ref: '#/components/schemas/Execution' } '402': description: Insufficient credits '403': description: Token lacks workflows:run '422': description: Validation failed /executions: get: summary: List executions parameters: - $ref: '#/components/parameters/Workspace' - name: status in: query schema: { type: string } - name: workflow_id in: query schema: { type: string, format: uuid } - name: trace_id in: query schema: { type: string } responses: '200': description: Cursor-paginated executions content: application/json: schema: type: object properties: data: { type: array, items: { $ref: '#/components/schemas/Execution' } } links: { type: object, additionalProperties: { type: [string, "null"] } } meta: { $ref: '#/components/schemas/CursorMeta' } /executions/{execution}: get: summary: Get an execution parameters: - $ref: '#/components/parameters/Workspace' - $ref: '#/components/parameters/Execution' responses: '200': description: Execution with redacted logs content: application/json: schema: type: object properties: data: { $ref: '#/components/schemas/Execution' } /executions/{execution}/logs: get: summary: List node logs parameters: - $ref: '#/components/parameters/Workspace' - $ref: '#/components/parameters/Execution' responses: '200': description: Redacted node inputs and outputs content: application/json: schema: type: object properties: data: { type: array, items: { $ref: '#/components/schemas/ExecutionLog' } } /executions/{execution}/cancel: post: summary: Cancel an execution parameters: - $ref: '#/components/parameters/Workspace' - $ref: '#/components/parameters/Execution' responses: '200': description: Cancelled content: application/json: schema: type: object properties: data: { $ref: '#/components/schemas/Execution' } '403': { description: 'Token lacks executions:write' } /executions/{execution}/resume: post: summary: Resume a failed or paused execution parameters: - $ref: '#/components/parameters/Workspace' - $ref: '#/components/parameters/Execution' requestBody: content: application/json: schema: type: object properties: input: { type: object, additionalProperties: true } responses: '200': description: Resumed content: application/json: schema: type: object properties: data: { $ref: '#/components/schemas/Execution' } /approvals/{token}: get: summary: Inspect an approval request by its one-time token security: [] parameters: - name: token in: path required: true schema: { type: string } responses: '200': description: Approval request, approver status and execution summary content: application/json: schema: type: object properties: data: { $ref: '#/components/schemas/Approval' } '404': { description: 'Unknown approval token' } post: summary: Decide an approval request security: [] parameters: - name: token in: path required: true schema: { type: string } requestBody: required: true content: application/json: schema: type: object required: [decision] properties: decision: { type: string, enum: [approve, reject] } comment: { type: string, maxLength: 2000 } otp: { type: string, description: Required for external approvers } responses: '200': description: Decision recorded content: application/json: schema: type: object properties: data: { $ref: '#/components/schemas/ApprovalDecision' } '409': { description: 'Already handled or expired' } '422': { description: 'Invalid decision or verification code' } /usage: get: summary: Credit balance and usage summary parameters: - $ref: '#/components/parameters/Workspace' responses: '200': description: Usage summary content: application/json: schema: type: object properties: data: { $ref: '#/components/schemas/Usage' } /knowledge-bases: get: summary: List knowledge bases parameters: - $ref: '#/components/parameters/Workspace' responses: '200': description: Knowledge bases with document and chunk counts content: application/json: schema: type: object properties: data: { type: array, items: { $ref: '#/components/schemas/KnowledgeBase' } } meta: { $ref: '#/components/schemas/CursorMeta' } /knowledge-bases/{knowledgeBase}/documents: post: summary: Add a text or URL document parameters: - $ref: '#/components/parameters/Workspace' - name: knowledgeBase in: path required: true schema: { type: string, format: uuid } requestBody: required: true content: application/json: schema: type: object required: [title] properties: title: { type: string } text: { type: string } url: { type: string, format: uri } responses: '202': description: Document queued for indexing content: application/json: schema: type: object properties: data: { $ref: '#/components/schemas/Document' } /knowledge-bases/{knowledgeBase}/search: post: summary: Hybrid vector + keyword search parameters: - $ref: '#/components/parameters/Workspace' - name: knowledgeBase in: path required: true schema: { type: string, format: uuid } requestBody: required: true content: application/json: schema: type: object required: [query] properties: query: { type: string } top_k: { type: integer, minimum: 1, maximum: 20 } rerank: { type: boolean, description: Override the knowledge base rerank setting } responses: '200': description: Ranked chunks with citations content: application/json: schema: type: object properties: data: { type: array, items: { $ref: '#/components/schemas/KnowledgeChunk' } } /hooks/{workspace}/{token}: post: summary: Ingest a webhook security: [] parameters: - name: workspace in: path required: true schema: { type: string } - name: token in: path required: true schema: { type: string } - name: Idempotency-Key in: header schema: { type: string } - name: X-Naba-Timestamp in: header schema: { type: string } - name: X-Naba-Signature in: header schema: { type: string } - name: wait in: query schema: { type: boolean } requestBody: content: application/json: schema: { type: object, additionalProperties: true } responses: '200': { description: 'Duplicate or synchronous result' } '202': { description: 'Accepted and queued' } '401': { description: 'Invalid token or signature' } '422': { description: 'Invalid trigger or payload' } '429': { description: 'Rate limited' } components: schemas: Workflow: type: object required: [id, name, slug, status, has_webhook, created_at, updated_at] properties: id: { type: string, format: uuid } name: { type: string } slug: { type: string } description: { type: [string, "null"] } status: { type: string, enum: [draft, published, archived] } version: { type: [integer, "null"] } has_webhook: { type: boolean } webhook_endpoint: { type: [string, "null"], format: uri } last_published_at: { type: [string, "null"], format: date-time } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } Execution: type: object required: [id, workflow_id, status, trigger_type, trace_id, credits_held, credits_settled, created_at] properties: id: { type: string, format: uuid } workflow_id: { type: string, format: uuid } workflow: type: object properties: id: { type: string, format: uuid } name: { type: string } version_id: { type: [string, "null"], format: uuid } status: { type: string, enum: [pending, running, paused, success, failed, cancelled, timed_out] } trigger_type: { type: string, enum: [manual, webhook, schedule, api, test, sub_workflow] } trace_id: { type: string } credits_held: { type: integer } credits_settled: { type: integer } error_summary: { type: [string, "null"] } input: { type: [object, "null"], additionalProperties: true } output: { type: object, additionalProperties: true } started_at: { type: [string, "null"], format: date-time } finished_at: { type: [string, "null"], format: date-time } paused_until: { type: [string, "null"], format: date-time } created_at: { type: string, format: date-time } logs: { type: array, items: { $ref: '#/components/schemas/ExecutionLog' } } links: { type: object, additionalProperties: { type: string } } ExecutionLog: type: object properties: id: { type: string, format: uuid } node_id: { type: string } node_key: { type: string } node_type: { type: string } status: { type: string } attempt: { type: integer } input: { type: [object, "null"], additionalProperties: true } output: { type: [object, "null"], additionalProperties: true } error: { type: [string, "null"] } credits: { type: integer } duration_ms: { type: [integer, "null"] } started_at: { type: [string, "null"], format: date-time } finished_at: { type: [string, "null"], format: date-time } Document: type: object properties: id: { type: string, format: uuid } knowledge_base_id: { type: string, format: uuid } title: { type: string } source_type: { type: string, enum: [file, text, url] } source_url: { type: [string, "null"], format: uri } status: { type: string, enum: [pending, processing, ready, failed] } chunk_count: { type: integer } language: { type: [string, "null"] } error: { type: [string, "null"] } processed_at: { type: [string, "null"], format: date-time } created_at: { type: string, format: date-time } KnowledgeBase: type: object properties: id: { type: string, format: uuid } name: { type: string } slug: { type: string } description: { type: [string, "null"] } embedding_provider: { type: string } embedding_model: { type: string } dimensions: { type: integer } rerank_enabled: { type: boolean } documents_count: { type: integer } chunks_count: { type: integer } created_at: { type: string, format: date-time } KnowledgeChunk: type: object properties: id: { type: string, format: uuid } document_id: { type: string, format: uuid } content: { type: string } chunk_index: { type: integer } metadata: { type: object, additionalProperties: true } score: { type: number } document_title: { type: [string, "null"] } source_type: { type: [string, "null"] } source_url: { type: [string, "null"], format: uri } Usage: type: object properties: workspace: type: object properties: id: { type: string, format: uuid } name: { type: string } plan: { type: string } credit_balance: { type: integer } period: type: object properties: start: { type: string, format: date-time } end: { type: string, format: date-time } credits_consumed: { type: integer } usage: type: array items: type: object properties: metric: { type: string } quantity: { type: number } cost_usd: { type: number } Approval: type: object properties: id: { type: string, format: uuid } status: { type: string, enum: [pending, approved, rejected, expired, cancelled] } policy: { type: string, enum: [any, all, n_of_m] } required_approvals: { type: integer } approved_count: { type: integer } expires_at: { type: string, format: date-time } execution_id: { type: string, format: uuid } workflow: { type: [string, "null"] } message: { type: [string, "null"] } approver: type: object properties: email: { type: string, format: email } status: { type: string } requires_otp: { type: boolean } ApprovalDecision: type: object properties: id: { type: string, format: uuid } status: { type: string } approver_status: { type: string } message: { type: string } ProblemDetails: type: object properties: type: { type: string } title: { type: string } status: { type: integer } detail: { type: string } errors: { type: object, additionalProperties: { type: array, items: { type: string } } } CursorMeta: type: object properties: next_cursor: { type: [string, "null"] } prev_cursor: { type: [string, "null"] } securitySchemes: bearerAuth: type: http scheme: bearer parameters: Workspace: name: X-Workspace in: header description: Workspace slug or UUID. Defaults to the token workspace. schema: { type: string } Execution: name: execution in: path required: true schema: { type: string, format: uuid }