# Run

## Run an automation

{% hint style="info" %}
Get `connectedAccountId` from [this](../social-accounts#add-a-social-account) API.

Get `automationId` from [this](../automations#get-all-automations) API.
{% endhint %}

## POST /api/v1/public/run

>

OpenAPI:

```json
{"openapi":"3.0.0","info":{"title":"TexAu APIs","version":"1.0"},"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}}},"paths":{"/api/v1/public/run":{"post":{"operationId":"ApiController_runAutomation","parameters":[{"name":"X-TexAu-Context","in":"header","description":"Pass orgUserId and workspaceId as ‘{\"orgUserId\":\"123\",\"workspaceId\":\"123\"}’","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"automationId":{"type":"string"},"connectedAccountId":{"type":"string"},"timezone":{"type":"string"},"inputs":{"type":"object"}},"required":["name","automationId","inputs"]}}}},"responses":{"201":{"description":"Automation started running successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"id":{"type":"string"},"workflowId":{"type":"string"}},"required":["id","workflowId"]}},"required":["success","message","data"]}}}},"401":{"description":"Unauthorized access"},"403":{"description":"Your plan does not have API access"},"422":{"description":"Requested workspace does not belongs to you"},"500":{"description":"Error in starting automation"}},"tags":["API Service"]}}}}
```

## Run a workflow

This API will be used to start a workflow using `workflowId`, you can get `workflowId` from [this](../workflows#api-v1-api-workflows) API

## POST /api/v1/public/run/{workflowId}

>

OpenAPI:

```json
{"openapi":"3.0.0","info":{"title":"TexAu APIs","version":"1.0"},"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}}},"paths":{"/api/v1/public/run/{workflowId}":{"post":{"operationId":"ApiController_runWorkflow","parameters":[{"name":"X-TexAu-Context","in":"header","description":"Pass orgUserId and workspaceId as ‘{\"orgUserId\":\"123\",\"workspaceId\":\"123\"}’","required":true,"schema":{"type":"string"}},{"name":"workflowId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"201":{"description":"Workflow execution started successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"id":{"type":"string"},"workflowId":{"type":"string"}},"required":["id","workflowId"]}},"required":["success","message","data"]}}}},"401":{"description":"Unauthorized access"},"403":{"description":"Your plan does not have API access"},"422":{"description":"Requested workspace does not belongs to you"},"500":{"description":"Error in running workflow"}},"tags":["API Service"]}}}}
```

## Get All Required Inputs For A Workflow

This API will give you data for required inputs of a workflow and platformId for which social Account ID will be passed in the next API call

## GET /api/v1/public/inputs/{workflowId}

>

OpenAPI:

```json
{"openapi":"3.0.0","info":{"title":"TexAu APIs","version":"1.0"},"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}}},"paths":{"/api/v1/public/inputs/{workflowId}":{"get":{"operationId":"ApiController_getWorkflowInputs","parameters":[{"name":"X-TexAu-Context","in":"header","description":"Pass orgUserId and workspaceId as ‘{\"orgUserId\":\"123\",\"workspaceId\":\"123\"}’","required":true,"schema":{"type":"string"}},{"name":"workflowId","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":""},"201":{"description":"Workflow inputs fetched successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"requiredInputs":{"type":"object","properties":{"automationId":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"label":{"type":"string"},"description":{"type":"string"},"type":{"type":"string"},"isRequired":{"type":"boolean"},"choices":{"type":"array","items":{"type":"object"}}},"required":["name","label","description","type","isRequired","choices"]}}},"required":["automationId"]},"socialAccountNeeded":{"type":"array","items":{"type":"string"}}},"required":["requiredInputs","socialAccountNeeded"]}},"required":["success","message","data"]}}}},"401":{"description":"Unauthorized access"},"403":{"description":"Your plan does not have API access"},"422":{"description":"Requested workspace does not belongs to you"},"500":{"description":"Error in getting workflow inputs"}},"tags":["API Service"]}}}}
```



The above API will give a response like this :&#x20;

```json
{
  "success": true,
  "message": "Inputs required for workflow fetched successfully",
  "data": {
    "requiredInputs": {
      "{{automationId1}}": [
        {
          "name": "liProfileUrl",
          "label": "Profile URL",
          "description": "LinkedIn Profile URL",
          "type": "text",
          "isRequired": true,
          "choices": []
        },
        {
          "name": "maxCount",
          "label": "Extract Limit",
          "description": "Recent Activity Extract Limit (Max. 1000)",
          "type": "number",
          "isRequired": false,
          "choices": []
        }
      ]
    },
    "socialAccountNeeded": [
      "{{platformId}}"
    ]
  }
}
```

## Configure and Run Workflow

This API will be used to configure workflow inputs, and social accounts and start the workflow.



This will take a body like this:&#x20;

<pre class="language-json"><code class="lang-json">{
  "inputs": {
    "{{automationId1}}": {
      "{{inputName1}}": "{{inputValue1}}",
<strong>      "{{inputName2}}": "{{inputValue2}}",
</strong>    }
  },
  "socialAccountIds": {
    "{{platformId}}": "{{socialAccountId}}"
  }
}
</code></pre>

## POST /api/v1/public/configure-run/{workflowId}

>

OpenAPI:

```json
{"openapi":"3.0.0","info":{"title":"TexAu APIs","version":"1.0"},"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}}},"paths":{"/api/v1/public/configure-run/{workflowId}":{"post":{"operationId":"ApiController_configureAndRunWorkflow","parameters":[{"name":"X-TexAu-Context","in":"header","description":"Pass orgUserId and workspaceId as ‘{\"orgUserId\":\"123\",\"workspaceId\":\"123\"}’","required":true,"schema":{"type":"string"}},{"name":"workflowId","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"inputs":{"type":"object"},"socialAccountIds":{"type":"object"}},"required":["inputs","socialAccountIds"]}}}},"responses":{"201":{"description":"Workflow execution started successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"id":{"type":"string"},"workflowId":{"type":"string"}},"required":["id","workflowId"]}},"required":["success","message","data"]}}}},"401":{"description":"Unauthorized access"},"403":{"description":"Your plan does not have API access"},"422":{"description":"Requested workspace does not belongs to you"},"500":{"description":"Error in running workflow"}},"tags":["API Service"]}}}}
```

## Run Automation with CSV input

### API for uploading CSV file

## POST /api/v1/public/csv-upload

>

OpenAPI:

```json
{"openapi":"3.0.0","info":{"title":"TexAu APIs","version":"1.0"},"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}}},"paths":{"/api/v1/public/csv-upload":{"post":{"operationId":"ApiController_uploadFile","parameters":[{"name":"X-TexAu-Context","in":"header","description":"Pass orgUserId and workspaceId as ‘{\"orgUserId\":\"123\",\"workspaceId\":\"123\"}’","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"filename":{"type":"string","format":"binary","description":"Upload file. Supported types: image/*, application/*"}}}}}},"responses":{"201":{"description":"File uploaded successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"csvUrl":{"type":"string"}},"required":["csvUrl"]}},"required":["success","message","data"]}}}},"401":{"description":"Unauthorized access"},"403":{"description":"Your plan does not have API access"},"422":{"description":"Requested workspace does not belongs to you"},"500":{"description":"Error occurred while uploading a file"}},"tags":["API Service"]}}}}
```

### API to invoke automation via CSV Url

You'll get csvUrl from the above API call.

{% hint style="info" %}
Create inputs object like this.

The key will be the input name and the value will be that CSV header which will be used as actual input.

Suppose CSV have 3 Headers: Profile URL, Keyword & Profile Picture. Now the inputs object will look like

```json
inputs: {"liProfileUrl": "Profile URL"}
```
{% endhint %}



## POST /api/v1/public/csv-input/run

>

OpenAPI:

```json
{"openapi":"3.0.0","info":{"title":"TexAu APIs","version":"1.0"},"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}}},"paths":{"/api/v1/public/csv-input/run":{"post":{"operationId":"ApiController_runAutomationWithCsvInput","parameters":[{"name":"X-TexAu-Context","in":"header","description":"Pass orgUserId and workspaceId as ‘{\"orgUserId\":\"123\",\"workspaceId\":\"123\"}’","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"automationId":{"type":"string"},"connectedAccountId":{"type":"string"},"csvUrl":{"type":"string"},"timezone":{"type":"string"},"inputs":{"type":"object"}},"required":["name","automationId","inputs"]}}}},"responses":{"201":{"description":"Automation started running successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"id":{"type":"string"},"workflowId":{"type":"string"}},"required":["id","workflowId"]}},"required":["success","message","data"]}}}},"401":{"description":"Unauthorized access"},"403":{"description":"Your plan does not have API access"},"422":{"description":"Requested workspace does not belongs to you"},"500":{"description":"Error in starting automation"}},"tags":["API Service"]}}}}
```

