# Create a Collection Source: https://docs.withcortex.ai/api-reference/endpoints/collections/create-a-collection post /apps/{app_id}/collections Create a new collection for your app. # Delete a Collection Source: https://docs.withcortex.ai/api-reference/endpoints/collections/delete-a-collection delete /apps/{app_id}/collections/{collection_id} Remove a collection from your app. # Get a Collection Source: https://docs.withcortex.ai/api-reference/endpoints/collections/get-a-collection get /apps/{app_id}/collections/{collection_id} Fetch detailed information about a specific collection. # Get Collections Source: https://docs.withcortex.ai/api-reference/endpoints/collections/get-collections get /apps/{app_id}/collections Get a list of all collections of your app. # Update a Collection Source: https://docs.withcortex.ai/api-reference/endpoints/collections/update-a-collection patch /apps/{app_id}/collections/{collection_id} Modify an existing collection. # Cancel File Upload Source: https://docs.withcortex.ai/api-reference/endpoints/files/cancel-file-upload post /apps/{app_id}/files/{file_id}/cancel Cancel the upload processing of a specific file. # Create a new file upload Source: https://docs.withcortex.ai/api-reference/endpoints/files/create-a-new-file-upload post /apps/{app_id}/files/uploads Create a new file upload that generates an upload URL. # Create File Source: https://docs.withcortex.ai/api-reference/endpoints/files/create-file post /apps/{app_id}/files Upload a new file to the app. Optionally specify a bucket. # Delete File Source: https://docs.withcortex.ai/api-reference/endpoints/files/delete-file delete /apps/{app_id}/files/{file_id} Delete a specific file from the app. # Delete File Upload Source: https://docs.withcortex.ai/api-reference/endpoints/files/delete-file-upload delete /apps/{app_id}/files/uploads/{file_upload_id} Delete a specific file upload. # Get File Source: https://docs.withcortex.ai/api-reference/endpoints/files/get-file get /apps/{app_id}/files/{file_id} Retrieve details of a specific file. # Get File Upload Source: https://docs.withcortex.ai/api-reference/endpoints/files/get-file-upload get /apps/{app_id}/files/uploads/{file_upload_id} Retrieve details of a specific file upload. # List File Uploads Source: https://docs.withcortex.ai/api-reference/endpoints/files/list-file-uploads get /apps/{app_id}/files/uploads Retrieve a list of files for a specific app. # List Files Source: https://docs.withcortex.ai/api-reference/endpoints/files/list-files get /apps/{app_id}/files Retrieve a list of files for a specific app. Optionally filter by bucket. # Update File Upload Source: https://docs.withcortex.ai/api-reference/endpoints/files/update-file-upload patch /apps/{app_id}/files/uploads/{file_upload_id} Update details of a specific file upload. # Upload a file Source: https://docs.withcortex.ai/api-reference/endpoints/files/upload-a-file post /public/apps/files/uploads/{file_upload_id} Uploads a file to the specified file upload ID placeholder # Cancel a Record Run Source: https://docs.withcortex.ai/api-reference/endpoints/records/cancel-a-record-run post /apps/{app_id}/collections/{collection_id}/records/{record_id}/cancel Cancel the ongoing execution of a record. # Create a Record Source: https://docs.withcortex.ai/api-reference/endpoints/records/create-a-record post /apps/{app_id}/collections/{collection_id}/records Create a new record in the specified collection. # Delete a Record Source: https://docs.withcortex.ai/api-reference/endpoints/records/delete-a-record delete /apps/{app_id}/collections/{collection_id}/records/{record_id} Delete a specific record by its ID. # Download Record Report Source: https://docs.withcortex.ai/api-reference/endpoints/records/download-record-report get /apps/{app_id}/collections/{collection_id}/records/{record_id}/download Generate and download a PDF report of a specific record. # Get a Record Source: https://docs.withcortex.ai/api-reference/endpoints/records/get-a-record get /apps/{app_id}/collections/{collection_id}/records/{record_id} Retrieve a specific record by its ID. # Get Record Status Source: https://docs.withcortex.ai/api-reference/endpoints/records/get-record-status get /apps/{app_id}/collections/{collection_id}/records/{record_id}/status Retrieve the current status of a specific record. # Get Records Source: https://docs.withcortex.ai/api-reference/endpoints/records/get-records get /apps/{app_id}/collections/{collection_id}/records Retrieve a list of records of a specific collection. # Reset Record Source: https://docs.withcortex.ai/api-reference/endpoints/records/reset-record post /apps/{app_id}/collections/{collection_id}/records/{record_id}/reset Reset the record status and rules. # Run a Record Source: https://docs.withcortex.ai/api-reference/endpoints/records/run-a-record post /apps/{app_id}/collections/{collection_id}/records/{record_id}/run Execute the rules associated with a specific record and get the report. # Update a Record Source: https://docs.withcortex.ai/api-reference/endpoints/records/update-a-record patch /apps/{app_id}/collections/{collection_id}/records/{record_id} Update an existing record by its ID. # Update Record Rules Source: https://docs.withcortex.ai/api-reference/endpoints/records/update-record-rules post /apps/{app_id}/collections/{collection_id}/records/{record_id}/update-rules Update the rules associated with a specific record. # Cancel Test Source: https://docs.withcortex.ai/api-reference/endpoints/tests/cancel-test post /apps/{app_id}/workflows/{workflow_id}/tests/{test_id}/cancel Cancel a running workflow test by its ID. # Cancel Tests Source: https://docs.withcortex.ai/api-reference/endpoints/tests/cancel-tests post /apps/{app_id}/workflows/{workflow_id}/tests/cancel Cancel all running workflow tests for a specific workflow. # Create a Test Source: https://docs.withcortex.ai/api-reference/endpoints/tests/create-a-test post /apps/{app_id}/workflows/{workflow_id}/tests Create a new workflow test for a specific workflow. # Create a Test Expectation Source: https://docs.withcortex.ai/api-reference/endpoints/tests/create-a-test-expectation post /apps/{app_id}/workflows/{workflow_id}/tests/expectations Create a new workflow test expectation for a specific workflow. # Delete Test Source: https://docs.withcortex.ai/api-reference/endpoints/tests/delete-test delete /apps/{app_id}/workflows/{workflow_id}/tests/{test_id} Delete a specific workflow test by its ID. # Delete Test Expectation Source: https://docs.withcortex.ai/api-reference/endpoints/tests/delete-test-expectation delete /apps/{app_id}/workflows/{workflow_id}/tests/expectations/{expectation_id} Delete a specific workflow test expectation by its ID. # Get Test Source: https://docs.withcortex.ai/api-reference/endpoints/tests/get-test get /apps/{app_id}/workflows/{workflow_id}/tests/{test_id} Retrieve a specific workflow test by its ID. # Get Test Expectation Source: https://docs.withcortex.ai/api-reference/endpoints/tests/get-test-expectation get /apps/{app_id}/workflows/{workflow_id}/tests/expectations/{expectation_id} Retrieve a specific workflow test expectation by its ID. # Get Tests Source: https://docs.withcortex.ai/api-reference/endpoints/tests/get-tests get /apps/{app_id}/workflows/{workflow_id}/tests Retrieve a list of workflow tests for a specific workflow. # Get Tests Expectations Source: https://docs.withcortex.ai/api-reference/endpoints/tests/get-tests-expectations get /apps/{app_id}/workflows/{workflow_id}/tests/expectations Retrieve a list of workflow test expectations for a specific workflow. # Get Tests Stats Source: https://docs.withcortex.ai/api-reference/endpoints/tests/get-tests-stats get /apps/{app_id}/workflows/{workflow_id}/tests/stats Retrieve statistics of workflow tests. # Run Test Source: https://docs.withcortex.ai/api-reference/endpoints/tests/run-test post /apps/{app_id}/workflows/{workflow_id}/tests/{test_id}/runs Run a specific workflow test by its ID. # Run Tests Source: https://docs.withcortex.ai/api-reference/endpoints/tests/run-tests post /apps/{app_id}/workflows/{workflow_id}/tests/runs Run all workflow tests for a specific workflow. # Update Test Source: https://docs.withcortex.ai/api-reference/endpoints/tests/update-test patch /apps/{app_id}/workflows/{workflow_id}/tests/{test_id} Update a specific workflow test by its ID. # Update Test Expectation Source: https://docs.withcortex.ai/api-reference/endpoints/tests/update-test-expectation patch /apps/{app_id}/workflows/{workflow_id}/tests/expectations/{expectation_id} Update a specific workflow test expectation by its ID. # Create App Variable Source: https://docs.withcortex.ai/api-reference/endpoints/variables/create-app-variable post /apps/{app_id}/variables Create a variable for a specific app. # Delete App Variable Source: https://docs.withcortex.ai/api-reference/endpoints/variables/delete-app-variable delete /apps/{app_id}/variables/{key} Delete a variable for a specific app. # Get App Variables Source: https://docs.withcortex.ai/api-reference/endpoints/variables/get-app-variables get /apps/{app_id}/variables Fetch all variables for a specific app. # Rename App Variable Source: https://docs.withcortex.ai/api-reference/endpoints/variables/rename-app-variable patch /apps/{app_id}/variables/{key} Rename a variable for a specific app. # Update App Variables Source: https://docs.withcortex.ai/api-reference/endpoints/variables/update-app-variables patch /apps/{app_id}/variables Update variables for a specific app. # Create a Webhook Source: https://docs.withcortex.ai/api-reference/endpoints/webhooks/create-a-webhook post /apps/{app_id}/webhooks Create a new webhook for a specific app. # Delete a Webhook Source: https://docs.withcortex.ai/api-reference/endpoints/webhooks/delete-a-webhook delete /apps/{app_id}/webhooks/{webhook_id} Delete an existing webhook for a specific app. # Get Webhooks Source: https://docs.withcortex.ai/api-reference/endpoints/webhooks/get-webhooks get /apps/{app_id}/webhooks Retrieve a list of webhooks for a specific app. # Update Webhook Source: https://docs.withcortex.ai/api-reference/endpoints/webhooks/update-webhook patch /apps/{app_id}/webhooks/{webhook_id} Update an existing webhook for a specific app. # Cancel a Discoverable Workflow Run Source: https://docs.withcortex.ai/api-reference/endpoints/workflows/cancel-a-discoverable-workflow-run post /apps/{app_id}/workflows/discover/{workflow_id}/runs/{run_id}/cancel Cancel a workflow run that is currently running. # Cancel a Workflow Run Source: https://docs.withcortex.ai/api-reference/endpoints/workflows/cancel-a-workflow-run post /apps/{app_id}/workflows/{workflow_id}/runs/{run_id}/cancel Cancel a workflow run that is currently running. # Discover Workflows Source: https://docs.withcortex.ai/api-reference/endpoints/workflows/discover-workflows get /apps/{app_id}/workflows/discover Retrieve a list of discoverable workflows for a specific app. # Get a Workflow Source: https://docs.withcortex.ai/api-reference/endpoints/workflows/get-a-workflow get /apps/{app_id}/workflows/{workflow_id} Retrieve a specific workflow by its ID. # Get a Workflow Run Source: https://docs.withcortex.ai/api-reference/endpoints/workflows/get-a-workflow-run get /apps/{app_id}/workflows/{workflow_id}/runs/{run_id} Retrieve details of a specific workflow run. # Get a Workflow Version Source: https://docs.withcortex.ai/api-reference/endpoints/workflows/get-a-workflow-version get /apps/{app_id}/workflows/{workflow_id}/versions/{version_id_or_version_number} Retrieve a specific workflow version by ID or version number. # Get Discoverable Workflow Source: https://docs.withcortex.ai/api-reference/endpoints/workflows/get-discoverable-workflow get /apps/{app_id}/workflows/discover/{workflow_id} Retrieve a specific discoverable workflow by its ID. # Get Discoverable Workflow Version Source: https://docs.withcortex.ai/api-reference/endpoints/workflows/get-discoverable-workflow-version get /apps/{app_id}/workflows/discover/{workflow_id}/versions/{version_id_or_version_number} Retrieve a specific version of a discoverable workflow by ID or version number. # Get Workflow Runs Source: https://docs.withcortex.ai/api-reference/endpoints/workflows/get-workflow-runs get /apps/{app_id}/workflows/{workflow_id}/runs Retrieve a list of runs for a specific workflow. # Get Workflow Versions Source: https://docs.withcortex.ai/api-reference/endpoints/workflows/get-workflow-versions get /apps/{app_id}/workflows/{workflow_id}/versions Retrieve a list of workflow versions for a specific workflow. # Get Workflows Source: https://docs.withcortex.ai/api-reference/endpoints/workflows/get-workflows get /apps/{app_id}/workflows Retrieve a list of workflows for a specific app. # Replay a Workflow Run Source: https://docs.withcortex.ai/api-reference/endpoints/workflows/replay-a-workflow-run post /apps/{app_id}/workflows/{workflow_id}/runs/{run_id}/replay Replay a specific workflow run. # Run a Workflow Source: https://docs.withcortex.ai/api-reference/endpoints/workflows/run-a-workflow post /apps/{app_id}/workflows/{workflow_id}/runs Run a specific workflow by its ID. # Run Discoverable Workflow Source: https://docs.withcortex.ai/api-reference/endpoints/workflows/run-discoverable-workflow post /apps/{app_id}/workflows/discover/{workflow_id}/runs Run a specific workflow by its ID. # Update Run Data Retention Configuration Source: https://docs.withcortex.ai/api-reference/endpoints/workflows/update-run-data-retention-configuration patch /apps/{app_id}/workflows/{workflow_id}/runs/{run_id}/retention Update the data retention configuration for a specific workflow run. # File Uploads Source: https://docs.withcortex.ai/api-reference/getting-started/file-uploads Learn how to use the File Uploads API to securely collect files from users without authentication. The File Uploads API allows you to create pre-signed URLs that users can use to upload files directly to Cortex without requiring an API key. This eliminates the need to implement authentication proxies for file uploads, making it easier to collect files from end-users securely. ## Use Cases * Collecting document uploads from users via your application * Enabling file uploads in public-facing forms * Gathering user-submitted files for processing in workflows ## How It Works 1. Your application requests a pre-signed upload URL from Cortex 2. Cortex returns the upload URL and a future file ID 3. Your application shares the upload URL with the end-user 4. The user uploads their file directly to this URL 5. The file becomes available in Cortex and can be referenced using the file ID ## Creating a Pre-signed URL ```javascript Node.js SDK import { Cortex } from '@cortex-ai/sdk'; const cortex = new Cortex({ apiKey: process.env.CORTEX_API_KEY, }); const uploadInfo = await cortex.apps.files.uploads.create(); // Share uploadInfo.upload_url with your users // Store uploadInfo.future_file_id to reference the file later ``` ```bash cURL curl -X POST "https://api.withcortex.ai/apps/c/files/uploads" \ -H "Authorization: Bearer YOUR_CORTEX_API_KEY" \ -H "Content-Type: application/json" \ -d '{}' ``` The response includes: * `upload_url`: URL where users can upload files * `future_file_id`: ID that will be assigned to the file once uploaded ## Uploading to the Pre-signed URL Once you have the upload URL, you upload files to it: ```javascript Upload Local File const formData = new FormData(); formData.append('file', fileObject); // fileObject from input[type="file"] // Upload the file await fetch(uploadInfo.upload_url, { method: 'POST', body: formData }); // Upload a file from a URL await fetch(uploadInfo.upload_url, { method: 'POST', body: JSON.stringify({ file_url: 'https://example.com/files/document.pdf' }) }); ``` ```bash cURL # Upload a local file curl -X POST "https://api.withcortex.ai/public/apps/files/uploads/fupl_xxxx" \ -F "file=@/path/to/local/document.pdf" # Or upload from a URL curl -X POST "https://api.withcortex.ai/public/apps/files/uploads/fupl_xxxx" \ -H "Content-Type: application/json" \ -d '{ "file_url": "https://example.com/files/document.pdf" }' ``` ## Using Uploaded Files in Workflows After a file is uploaded, The uploaded file is now available using the future\_file\_id and can be referenced wherever the upload URL was created, such as when running a workflow that requires a file input, for example: ```javascript Node.js SDK import { Cortex } from '@cortex-ai/sdk'; const cortex = new Cortex({ apiKey: process.env.CORTEX_API_KEY, }); // Run a workflow with the uploaded file const run = await cortex.apps.workflows.runs.create('YOUR_WORKFLOW_ID', { input: { documents: [uploadInfo.future_file_id] } }); ``` ```bash cURL curl -X POST "https://api.withcortex.ai/apps/c/workflows/YOUR_WORKFLOW_ID/runs" \ -H "Authorization: Bearer YOUR_CORTEX_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "input": { "documents": ["afile_xxxx"] } }' ``` Complete API documentation including all available parameters and response fields {' '} # Introduction Source: https://docs.withcortex.ai/api-reference/getting-started/introduction Understand general concepts, response codes, and authentication strategies. ### Base URL The Cortex API is built on **REST** principles. We enforce **HTTPS** in every request to improve data security, integrity, and privacy. The API does not support **HTTP**. All requests contain the following base URL: ``` https://api.withcortex.ai ``` ### Authentication To authenticate, you need to add an Authorization header with the contents being `Bearer YOUR_API_KEY`. ``` Authorization: Bearer YOUR_API_KEY ``` Go to the [API Keys page](https://withcortex.ai/c/settings/api-keys) and create a new API key. ### Response codes Cortex uses standard HTTP codes to indicate the success or failure of your requests. In general, `2xx` HTTP codes correspond to success, `4xx` codes are for user-related failures, and `5xx` codes are for infrastructure issues. | Status | Description | | ------ | --------------------------------------- | | `200` | Successful request. | | `400` | Check that the parameters were correct. | | `401` | Check that the API key is correct. | | `404` | The resource was not found. | | `429` | The rate limit was exceeded. | | `5xx` | Indicates an error with Cortex servers. | ### Rate limits Cortex enforces rate limits to ensure fair usage of the API. If you exceed the rate limit, you will receive a `429` status code. The rate limit is currently set at **500 requests per minute per IP address**. We are working on a more flexible rate limit system. # Pagination and Filtering Source: https://docs.withcortex.ai/api-reference/getting-started/pagination-and-filtering Learn how to paginate and filter responses from the Cortex API. ### Pagination When endpoints return large datasets, such as collections, pagination helps manage the response. Use the `page` and `take` query parameters to control pagination: * **`page`**: Specifies the page number to retrieve. Default is `1`. * **`take`**: Specifies the number of records per page. Default is `100`. To retrieve the first 50 collections in an organization, use the following query parameters: ```bash curl --request GET \ --url 'https://api.withcortex.ai/apps/{app_id}/collections?page=1&take=50' ``` ### Filtering Endpoints may support filtering to refine responses. Filtering parameters vary by endpoint. For example, the `/collections` endpoint supports the following filters: * **`search`**: Search for a specific term within the response. * **`visibility`**: Filter collections by visibility status. * **`tags`**: Filter collections by associated tags. To search for collections with the term "Debt," visibility "PUBLIC," and tags "pending," use these query parameters: ```bash curl --request GET \ --url 'https://api.withcortex.ai/apps/{app_id}/collections?search=Debt&visibility=PUBLIC&tags=pending' ``` Filtering parameters vary by endpoint. Refer to the endpoint documentation for the specific parameters supported. # Collections Source: https://docs.withcortex.ai/collections/overview The no-code UI for workflow management. Collections in Cortex provide a structured way to store, classify, and manage workflow-related data securely. They serve as the visual interface for non-technical users to interact with workflows, records, and automation—without writing a single line of code. Users can create collections manually or from existing templates, ensuring flexibility and efficiency in organizing their workflows. ## Why Use Collections? * **No-Code Friendly** - A structured UI that allows users to manage records, and apply rules effortlessly. * **Secure Data Management** - Store and classify data in an organized, role-based environment. * **Flexible Organization** - Create collections manually or use prebuilt templates for a faster setup. * **Automation Control** - Trigger workflows, update records, and apply business rules—all from an intuitive interface. * **Prebuilt Templates & Components** - Get started quickly with ready-made collection structures for common use cases. Whether you're managing applications, approvals, or business processes, Collections provide a seamless, no-code experience—unlocking the full power of Cortex for non-technical and technical users alike. ## Key Features * **Create Collections** - Users can create new collections by entering a name. * **Collection Templates** - Start from an existing collection template to streamline setup and maintain consistency. * **Tagging System** - Organize collections using customizable tags for easier search and categorization. * **Rules & Records** - View and manage Records and Rules assigned to each collection. ## Create a Collection