Skip to content

Start Automation API

This page details the REST API endpoint for starting a Datallog automation remotely. This is useful for integrating Datallog workflows with other services or triggering them programmatically.

Endpoint

To start an automation, send a POST request to the following endpoint:

POST https://mwm.datallog.com/api/start-automation/<project_name>/<automation_name>

Authentication

All API requests must be authenticated using a bearer token. You must include an Authorization and X-Api-Key header with your API token.

http
Authorization: Token <YOUR_AUTHORIZATION_TOKEN>
X-Api-Key: <YOUR_X_API_KEY>

TIP

You can generate and manage your API tokens from the Settings section of your Datallog dashboard.

Path Parameters

ParameterTypeRequiredDescription
<project_name>stringYesThe name of your project, as created with the datallog create-project command.
<automation_name>stringYesThe name of the automation within the project, as created with the datallog create-automation command.

Request Body

The request body must be a JSON object with the following optional fields:

ts
interface StartAutomation {
  webhook?: string;
  webhook_header?: Record<string, string>;
  seed?: Record<string, any>;
}
FieldTypeRequiredDescription
webhookstringNoA specific URL to which the final result of this execution will be sent. If this field is omitted or left blank, the default webhook configured for the automation will be used.
webhook_headerRecord<string, string>NoA JSON object of key-value pairs representing custom HTTP headers to be sent with the webhook request. This can be used for authentication or for passing metadata.
seedRecord<string, any>NoThe initial JSON data passed as an argument to the automation's @core_task. This is the API equivalent of using the --seed or --seed-file argument when running an automation with the Datallog CLI.

TIP

The seed data you provide here is passed directly to the first argument of your @core_task function. For example, if you send {"seed": {"message": "Hello from API"}}, the seed parameter in your Python function will be {'message': 'Hello from API'}.

Examples

Let's assume we have a project named my-first-datallog-project and an automation named hello-automation, as shown in the Quick Start guide.

Example 1: Basic execution with seed data

This example starts the automation and provides initial data to the core_task.

cURL

bash
curl -X POST \
  https://mwm.datallog.com/api/start-automation/my-first-datallog-project/hello-automation \
  -H "Authorization: <YOUR_AUTHORIZATION_TOKEN>" \
  -H "X-Api-Key: <YOUR_X_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "seed": {
      "message": "Hello from the API!"
    }
  }'

Python (requests)

python
import requests
import json

authorization_token = "<YOUR_AUTHORIZATION_TOKEN>"
x_api_key = "<YOUR_X_API_KEY>"
project_name = "my-first-datallog-project"
automation_name = "hello-automation"

url = f"https://mwm.datallog.com/api/start-automation/{project_name}/{automation_name}"

headers = {
    "Authorization": authorization_token,
    "X-Api-Key": x_api_key,
    "Content-Type": "application/json"
}

payload = {
    "seed": {
        "message": "Hello from the API!"
    }
}

response = requests.post(url, headers=headers, data=json.dumps(payload))

print(response.status_code)
print(response.json())

Example 2: Execution with a custom webhook

This example starts the automation and directs the final output to a custom endpoint with a specific authentication header.

cURL

bash
curl -X POST \
  https://mwm.datallog.com/api/start-automation/my-first-datallog-project/hello-automation \
  -H "Authorization: <YOUR_AUTHORIZATION_TOKEN>" \
  -H "X-Api-Key: <YOUR_X_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "webhook": "https://my-service.com/datallog-results",
    "webhook_header": {
      "x-api-key": "my-secret-service-key"
    },
    "seed": {
      "message": "Data for my custom webhook"
    }
  }'

Responses

Success Response

On a successful request to start the automation, the API will return a 202 Accepted status code. The body will contain a unique execution_id that you can use to track the run's status.

  • Code: 200 OK
    Description: The automation has been successfully started.
  • Body:
json
{
  "status": "success",
  "message": "Automation 'hello-automation' started successfully.",
  "execution_id": "exec_abc123def456"
}

Error Responses

If the request fails, the API will return an appropriate error code and a descriptive message.

  • Code: 403 Forbidden
    Reason: The user does not have permission to access the specified project or automation.

    json
    {
      "message":"This Project does not exist. consult API"
    }
  • Code: 403 Forbidden
    Reason: The user does not have permission to access the specified project or automation.

    json
    {
      "message": "This Automation does not exist. consult API."
    }
  • Code: 401 Unauthorized
    Reason: The request did not include valid authentication credentials.

    json
    {
      "detail": "Authentication credentials were not provided."
    }