Skip to main content
Intakes provide automated document ingestion endpoints. Each intake defines a way for external systems to submit documents into a specific document store, enrich or reject the upload, and start the right Activity Plan for the business process. Intakes page showing configured intake endpoints with names, target stores, and status

How Intakes Work

An intake creates an HTTP endpoint that external systems can send documents to. When a document arrives at an intake endpoint:
  1. The document is uploaded to the configured document store
  2. If a script is configured, it runs to validate or enrich the document metadata
  3. A document family is created for tracking
  4. If an Activity Plan is configured or returned by the script, an Activity is started
  5. Any configured knowledge features are assigned to the document
  6. Domain events are published for downstream automation and audit

Upload Endpoint

Each intake exposes an upload endpoint at:
For example, an intake with slug invoice-upload in organization acme-corp would be available at:

Single File Upload

Multiple File Upload

When Allow Multiple Files is enabled on the intake, you can upload multiple files in a single request:
When providing metadata for multiple files, use a JSON array where each element corresponds to a file by index. If a single JSON object is provided instead, it is applied to all files.

Request Parameters

Response

Returns HTTP 201 on success with the created document family object. For multiple files, returns an array of document family objects.
External data is stored directly in the KDDB document, not in a separate database table. Processing modules can access it via doc.get_external_data() (Python) or doc.getExternalData() (TypeScript/WASM). The platform UI reads it directly from the loaded document.

Configuring an Intake

1

Create Intake

Click the add button on the Intakes page. Provide a name and slug for the intake. The slug determines the upload endpoint URL.
2

Select Target Store

Choose the document store where incoming documents should be stored.
3

Configure Options

Set up optional features such as scripting, Activity Plans, knowledge features, and metadata.

Intake Settings

Script Tab

Intakes support a JavaScript scripting tab that lets you run custom logic on each uploaded file before it is stored. Scripts run in a Goja JavaScript runtime with a 5-second timeout.

Available Variables

Return Value

Scripts return an object that controls how the upload is processed:

Activity Plan Selection

When the activityPlan field is present in the return value, the script controls which Activity Plan starts for the upload:
  • Bare slug — starts the Activity Plan with that slug in the current organization
  • activity-plan://orgSlug/planSlug URI — starts the referenced Activity Plan
  • Field omitted entirely — falls back to the static Activity Plan configured on the intake
The Activity Plan must be bound to a project through project resources. Kodexa attaches the uploaded document family to the Activity automatically and records the document family ID in trigger metadata. Task Templates are not selected by the intake script in the current model. If the workflow needs human review, the selected Activity Plan should use a CREATE_TASK step that references the Task Template.
When scripting is enabled, the static Activity Plan dropdown in the Settings tab is disabled. Activity selection moves to the script.

Example: Validate File Size

Example: Route by Document Content

Example: Dynamic Activity Routing

Route documents to different Activity Plans based on content:
This script inspects the document text and:
  • Starts the invoice intake Activity Plan for invoices, passing the detected amount
  • Starts the contract intake Activity Plan for contracts
  • Sends unrecognized documents to a document triage Activity Plan
  • Leaves Task creation decisions inside the Activity Plan step graph
Enable the Script toggle to activate script execution. You can disable it without deleting the script code.

Loading Shared Modules

Intake scripts can load shared JavaScript modules using the Module Refs picker in the Script tab. Pre-loaded modules’ functions and variables are available in global scope within your intake script, letting you reuse common validation, transformation, or enrichment logic across multiple intakes. Select one or more JavaScript modules from your organization. They are fetched and executed in order before your intake script runs.

Activity Plan

Static Assignment

Select an Activity Plan from the dropdown to automatically start an Activity for each uploaded document. When configured:
  • An Activity is started from the selected plan
  • The uploaded document family is linked to the Activity
  • Activity inputs default to {} unless a script supplies inputs
  • Any human work is created by CREATE_TASK steps inside the Activity Plan
This is useful for simple intake workflows where every document should enter the same business process.

Script-Driven Assignment

When a processing script is enabled on the intake, the static Activity Plan dropdown is disabled. Instead, the script controls which Activity Plan starts by returning activityPlan, title, description, and inputs. This allows:
  • Conditional routing — different document types enter different Activity Plans
  • Activity inputs — pass classification, source-system, priority, or extraction hints into the plan
  • Consistent human work — create Tasks from CREATE_TASK steps inside the plan when review is needed
  • Reusable process design — keep the business workflow in an Activity Plan instead of embedding it in an intake script
See the Script Tab section for the full return value reference and examples.
Activity Plan slugs in the script must resolve to Activity Plans in your organization, and those plans must be bound to a project. If the plan cannot be resolved or started, the upload still succeeds but no Activity is created.

Knowledge Features

Select one or more knowledge feature types to automatically assign to every document uploaded through this intake. This lets you pre-classify documents at ingestion time — for example, tagging all documents from a specific intake as belonging to a particular vendor or document category.

Processing Metadata

The Processing Metadata section lets you define key-value pairs that are attached to every document uploaded through this intake. These metadata values are available to downstream Activity steps and processing modules. Metadata is merged in this order (later values override earlier ones):
  1. Intake-level metadata (configured here)
  2. Metadata extracted from the document file
  3. Per-upload metadata (provided in the API request)
  4. Script modifications (if a script is enabled)
The following keys are reserved and automatically stripped from the metadata object before storage. Use them as separate form parameters instead: externalData, labels, statusId, knowledgeFeatures, documentVersion.
Labels are normalized to uppercase before storage. For example, labels=invoice,urgent creates labels INVOICE and URGENT. Labels that don’t exist in the organization are created automatically.

API Tokens

The API Tokens tab lets you create scoped tokens for machine-to-machine authentication against a specific intake endpoint. Unlike user API keys, intake tokens are scoped to a single intake and bypass user authentication — making them ideal for automated pipelines, third-party integrations, and CI/CD workflows.

Creating a Token

1

Open the API Tokens tab

Select an intake and navigate to the API Tokens tab.
2

Create a new token

Click the add button. Optionally set an expiration date.
3

Copy the token

The plaintext token (prefixed with kit_) is shown only once. Copy it immediately and store it securely.
Token values are shown only at creation time. After you close the dialog, only a hint (last 4 characters) is displayed. If you lose the token, you must create a new one.

Using Intake Tokens

Pass the token in the x-api-key header when uploading to the intake endpoint:
Intake tokens only grant access to the specific intake they were created for. They cannot be used to access other API endpoints.

Managing Tokens

The API Tokens tab displays all tokens for the intake with their creation date, hint, and expiration status. Click the delete button to revoke a token. A confirmation dialog is shown before deletion.

Token Security

  • Tokens are hashed with SHA-256 before storage — the platform never stores plaintext tokens
  • Each token is scoped to a single intake and cannot access other resources
  • Tokens can have optional expiration dates
  • Revoked tokens take effect immediately
Each intake provides a unique URL. Keep intake URLs and authentication credentials secure, as anyone with access can submit documents to your organization.