Skip to main content
This guide shows you how to authenticate, run your first workflow, and retrieve results.

Process a document in 60 seconds

Run this single script to authenticate, create a flow, and process your first invoice:
  1. Authenticated with your SuperAI account.
  2. Created a 4-task invoice processing flow: Receive File → Convert to Text → Extract Invoice Data → Validate.
  3. Started processing a sample invoice PDF.
  4. Got back a flow ID and execution ID to track progress.
Check the dashboard link to watch your flow process the document. Got an error? Jump to Troubleshooting.

What are SuperAI Flows?

SuperAI Flows automate multi-step document processing pipelines. A typical flow:
  1. Classifies documents (invoice, receipt, contract)
  2. Extracts structured data based on document type
  3. Validates extracted values
  4. Delivers results via webhook or API

Flow definition example

Flows are defined in declarative YAML that’s both human-readable and type-safe. Here’s a complete document processing workflow:
Key features:
  • Task chainingextract_data references output from classify_document using {{classify_document.splits[0].document_url}}
  • Type safety — Each field specifies a data_type (string, float, etc.)
  • Built-in executors — Use pre-built task executors like document_classifier and text_to_structured
  • Validation — Chain validation tasks to ensure data quality
The platform automatically resolves dependencies, handles retries, and manages data flow between tasks.

Prerequisites

  • A SuperAI account (sign up free)
  • Your login email and password
  • curl and jq installed (for testing examples)

Authentication

SuperAI uses JWT-based authentication. All API requests require a valid access token.
1

Get the anonymous key

This is a public endpoint — no auth required.
2

Exchange credentials for JWT tokens

3

Use the access token in every request

Token management

Tokens grant full account access — treat them like passwords. Store them in environment variables or secret managers, never in code, and always use HTTPS.
When your access token expires, use the refresh token to get a new one without re-authenticating:

Run your first flow

Start a flow by creating a flow execution with your input data.
Key fields:
  • id — The flow execution ID (use this to check status and retrieve results)
  • status — Current execution state (running, completed, failed)
  • flow_version — Version of the flow used (remains constant even if the flow is updated)
The input object structure depends on your flow’s configuration. For file-based flows, provide filename, mime_type, and document_url. Other flows may have different input schemas — check the flow’s input_schema.

Check execution status

Retrieve results

Get task execution results for your flow:
Common query parameters:
  • flow_execution_id — Filter by flow execution (required for most queries)
  • task_name — Filter by specific task name
  • task_execution_idx — Filter by execution attempt (0 = first attempt, 1 = first retry)
Instead of polling for results, configure webhooks to receive real-time notifications when flows complete. The Webhook Notification task sends POST requests to your specified URL. Add a Webhook Notification task to your flow with these parameters:
  • Url (required) — Your webhook endpoint URL
  • Authorization Header Value (optional) — Auth token or API key for securing your webhook
  • Payload (required) — The data to send (can reference task outputs using {{task_name.field}} syntax)
Example payload:
Your webhook endpoint should validate the authorization header (if provided via the x-webhook-token header), process the payload, and return a 2xx status code to acknowledge receipt.

Troubleshooting

  • Verify your credentials work in the web UI first at flows.super.ai.
  • Check for special characters in your password; wrap it in single quotes to preserve them: export PASSWORD='your-password'.
  • Verify the anonymous key is valid — it should be a long JWT string.
  • Verify the flow was created successfully (check the flow creation response).
  • List all flows you have access to: curl https://flows.super.ai/api/flows -H "Authorization: Bearer $TOKEN".
  • Confirm you’re using the correct UUID and are logged into the correct organization — flows are organization-specific.
Your token expired after 1 hour. Use the refresh token to obtain a new access token (see Authentication).
  • Validate your JSON is well-formed (pipe it through jq).
  • For custom flows, check the required input schema: curl "https://flows.super.ai/api/flows/$FLOW_ID" -H "Authorization: Bearer $TOKEN" | jq .input_schema.
Some flows take minutes for complex documents. Use webhooks instead of polling, and inspect task executions to see which task is blocking: curl "https://flows.super.ai/api/task-executions?flow_execution_id=$EXEC_ID" -H "Authorization: Bearer $TOKEN" | jq '.task_executions[] | {task_name, status}'.
The API implements fair-use rate limiting. If you receive 429 (Too Many Requests), wait before retrying and implement exponential backoff.
Still stuck? Check status.super.ai, then contact support@super.ai with your flow execution ID and the request_id from any error responses.

Error handling

The API uses standard HTTP status codes: Errors follow a consistent format. See the full Error Codes reference.

Next steps

Downloading files

Retrieve gs:// files returned in your flow outputs.

API Reference

Full endpoint documentation with schemas.