Quickstart
Welcome to Captain Data’s API implementation guide.
This guide will help you launch workflows, manage API jobs, and make the most of our platform. Follow the steps below to get up and running quickly.
1. Introduction to the Captain Data API
The Captain Data API allows you to automate workflows, extract data, and integrate powerful tools into your processes. Whether you’re building custom integrations or scaling operations, the API offers flexibility and efficiency.
For more details, see our API Reference Documentation.
2. Setting Up the API
Follow these steps to get started to get your API Key:
- Log in to your Captain Data account.
- Navigate to the My Account > General section in your workspace.
- Copy your API key.
3. Setting up your workspace
In the “My Workflows” section, we recommend creating the following folders to organize your workspace:
- Staging: Use this folder to test your workflow implementations before deploying them.
- Production: Once tested and finalized, duplicate your workflows into this folder for live use.
Home is the default folder provided by the platform. It cannot be deleted.
4. Launching Workflows
Understanding Workflows
A Workflow is a sequence of action steps that extracts, processes, and delivers data.
A Run (ex-Job) refers to the execution of a workflow. For a single workflow, you can have multiple Runs over time, e.g. one workflow may be executed daily, resulting in numerous Runs.
How to Launch a Workflow
- On the Captain Data platform, identify the workflow(s) you want to launch (e.g. Extract LinkedIn People Profile)
- Click on “Try it”, and select the folder you want to create the workflow in (e.g. Staging)
- Once selected, the workflow will be created in the specified folder—it’s as if you’ve just generated an API endpoint for it.
- Navigate to the workflow in your folder and locate the Workflow UID in the URL.
In this example the workflow UID is 0d179c07-6443-4eeb-ada7-652fb498f997.
Use the Launch a Workflow endpoint to run a workflow.
Open your workflow’s edition page to make an initial configuration. Next, navigate to the workflow’s API Playground and use the generated request body to schedule the workflow.
Example of a generated cURL to schedule a flow:
5. Managing Workflow Runs
When you execute a workflow, a run is generated along with a run (job) UID, which you can find in the response of the Launch a Workflow API call.
Check Workflow Status
You can monitor the progress of your Run using the Get a Run endpoint that points to https://api.captaindata.co/v3/jobs/:job_uid
.
Response Fields:
Common Job Statuses
Status | Description |
---|---|
running | Workflow is in progress. |
completed | Workflow finished successfully (with results or not). |
shutdown | Automation triggered an error, usually due to a technical issue retrieved from a 3rd-party API or on our end. |
warning | Automation triggered a warning, often a functional error (e.g. bad input). Retry using the “Retry a job” endpoint. |
pending | The Run is waiting to be processed. |
stopped | The Run was manually stopped by the user. |
paused | The Run was paused due to an integration error (e.g. invalid cookies, invalid OAuth credentials, etc.). Retry using the “Retry a job” endpoint. |
Retrieve Run Results
Once the run is marked as completed, you can fetch the results using the same run UID.
The results will be included in the response of the Get a Run’s Results request with the route /v3/jobs/:job_uid/results
.
Results are returned with the following structure:
Handling Run Updates with Webhooks
To handle workflow executions asynchronously and improve scalability, Captain Data provides webhook support. With webhooks, you can receive real-time notifications when the status of a job changes (e.g., success, created or failed).
Setting Up a Webhook:
- Navigate to the workflow you want to add a webhook on
- Configure your webhook URL in the Captain Data platform under the Webhook section
- The webhook will send a POST request to your specified URL whenever a run status changes
6. Best Practices and Troubleshooting
- Start small: When using the API, we suggest testing with a small batch of inputs first. This allows you to validate your setup and ensure everything works smoothly before scaling your processes.
- Rate Limits: Be mindful of rate limits to avoid unnecessary throttling (learn more here).