> For the complete documentation index, see [llms.txt](https://texau.gitbook.io/api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://texau.gitbook.io/api-docs/reference/api-reference/run.md).

# Run

## Run an automation

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

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

## POST /api/v1/public/run

>

```json
{"openapi":"3.0.0","info":{"title":"TexAu APIs","version":"1.0"},"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"RunDto":{"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"]},"RunOutputDto":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"$ref":"#/components/schemas/RunData"}},"required":["success","message","data"]},"RunData":{"type":"object","properties":{"id":{"type":"string"},"workflowId":{"type":"string"}},"required":["id","workflowId"]}}},"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":{"$ref":"#/components/schemas/RunDto"}}}},"responses":{"201":{"description":"Automation started running successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunOutputDto"}}}},"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](/api-docs/reference/api-reference/workflows.md#api-v1-api-workflows) API

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

>

```json
{"openapi":"3.0.0","info":{"title":"TexAu APIs","version":"1.0"},"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"RunOutputDto":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"$ref":"#/components/schemas/RunData"}},"required":["success","message","data"]},"RunData":{"type":"object","properties":{"id":{"type":"string"},"workflowId":{"type":"string"}},"required":["id","workflowId"]}}},"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":{"$ref":"#/components/schemas/RunOutputDto"}}}},"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}

>

```json
{"openapi":"3.0.0","info":{"title":"TexAu APIs","version":"1.0"},"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"GetWorkflowInputDto":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"$ref":"#/components/schemas/InputData"}},"required":["success","message","data"]},"InputData":{"type":"object","properties":{"requiredInputs":{"$ref":"#/components/schemas/RequiredInputs"},"socialAccountNeeded":{"type":"array","items":{"type":"string"}}},"required":["requiredInputs","socialAccountNeeded"]},"RequiredInputs":{"type":"object","properties":{"automationId":{"type":"array","items":{"$ref":"#/components/schemas/Inputs"}}},"required":["automationId"]},"Inputs":{"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"]}}},"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":{"$ref":"#/components/schemas/GetWorkflowInputDto"}}}},"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}

>

```json
{"openapi":"3.0.0","info":{"title":"TexAu APIs","version":"1.0"},"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"ConfigureAndRunDto":{"type":"object","properties":{"inputs":{"type":"object"},"socialAccountIds":{"type":"object"}},"required":["inputs","socialAccountIds"]},"ConfigureRunOutputDto":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"$ref":"#/components/schemas/RunData"}},"required":["success","message","data"]},"RunData":{"type":"object","properties":{"id":{"type":"string"},"workflowId":{"type":"string"}},"required":["id","workflowId"]}}},"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":{"$ref":"#/components/schemas/ConfigureAndRunDto"}}}},"responses":{"201":{"description":"Workflow execution started successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfigureRunOutputDto"}}}},"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

>

```json
{"openapi":"3.0.0","info":{"title":"TexAu APIs","version":"1.0"},"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"FileUploadDto":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"$ref":"#/components/schemas/FileData"}},"required":["success","message","data"]},"FileData":{"type":"object","properties":{"csvUrl":{"type":"string"}},"required":["csvUrl"]}}},"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":{"$ref":"#/components/schemas/FileUploadDto"}}}},"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

>

```json
{"openapi":"3.0.0","info":{"title":"TexAu APIs","version":"1.0"},"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"scheme":"bearer","bearerFormat":"JWT","type":"http"}},"schemas":{"CsvInputRunDto":{"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"]},"RunOutputDto":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"data":{"$ref":"#/components/schemas/RunData"}},"required":["success","message","data"]},"RunData":{"type":"object","properties":{"id":{"type":"string"},"workflowId":{"type":"string"}},"required":["id","workflowId"]}}},"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":{"$ref":"#/components/schemas/CsvInputRunDto"}}}},"responses":{"201":{"description":"Automation started running successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunOutputDto"}}}},"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"]}}}}
```
