# Runs_RunJob

Create a new Transaction Tax Extract (TTE) pipeline job.

`POST /v1/companies/{companyId}/Runs`

**API:** Avalara Tax Content - Job and Data Management Service
**Tag:** Runs
**API Version:** v1
**Base URL:** https://rest.avatax.com/api/v2/content/jobs
**Authentication:** Basic (username + license key) or Bearer token

Source: https://developer.avalara.com/products/avalara-tax-content/api/jms/methods/Runs/Runs_RunJob/

## Description

Creates a new Transaction Tax Extract pipeline job for a company. Jobs are the way that Avalara Tax Content for Retail delivers tax content to your point of sale system. 
You tell the API how to combine your settings (TTE, notification option, and delivery option), and then run the job when you are ready to receive the tax content.
            
Create a job by entering a unique name and specifying job settings. You can then run the job immediately, or save it
to be run at a later time. If a job is already running, you'll only have the option to save.

## Parameters

| Name | Type | In | Required | Description |
|---|---|---|---|---|
| `companyId` | integer | path | Yes | ID of the company to run this job for. Required. |

## Request Body

**Content-Type:** `application/json`
**Schema:** `Avalara.POS.API.JMS.Models.RunConfigModel`

Represents a configuration for a new Content Extract Pipeline run.

| Property | Type | Required | Description |
|---|---|---|---|
| `name` | string | **Yes** | Specify a name for this pipeline run. Example: `SampleJob`. |
| `jobId` | string | **Yes** | Specify an ID for this job. This ID can be used to retrieve a run for a specific job. Example: `00000000-0000-0000-0000-000000000000`. |
| `configurationName` | string | **Yes** | The configuration name for this pipeline run. Example: `SampleConfigName`. |
| `execution_details` | Avalara.POS.API.JMS.Models.JobExecutionDetails | No |  |
| `configurations` | Avalara.POS.API.JMS.Models.RunConfigModel+ConfigurationModel[] | **Yes** | Run configurations for each company to extract data for.
            
Can either be in the form of a fully explicit run configuration
or a configuration ID representing an existing configuration.
networkDetails only needed in case of destination = exavault |
| `jobType` | string | **Yes** | Specify the job type.

Values: `Production`, `Test` Example: `Production`. |
| `output_type` | string | **Yes** | Specify the output type.

Values: `Full` for a full run or `Differences only` for changes.

- `Full`: Run a full job. This downloads the all of the associated tax content for use with your point of sale (POS) system.
- `Differences only`: Retrieve just the changes in a job. This creates a file that identifies the differences in tax content between two job runs. 
   You can compare the output between a new and a previous job run or between two previous job runs. Requires `base_run_id` to be set. Example: `Full`. |
| `base_run_id` | string | No | When running a `Differences only` job, specify the base run ID for the job you want to compare this to. Example: `00000000-0000-0000-0000-000000000000`. |
| `productType` | string | No | productType used to differenciate between ATC products default(retail), lodging, managers. Example: `default`. |
| `prebuiltTemplate` | Avalara.POS.API.JMS.Models.PrebuiltTemplate | No |  |

**Content-Type:** `text/json`
**Schema:** `Avalara.POS.API.JMS.Models.RunConfigModel`

Represents a configuration for a new Content Extract Pipeline run.

| Property | Type | Required | Description |
|---|---|---|---|
| `name` | string | **Yes** | Specify a name for this pipeline run. Example: `SampleJob`. |
| `jobId` | string | **Yes** | Specify an ID for this job. This ID can be used to retrieve a run for a specific job. Example: `00000000-0000-0000-0000-000000000000`. |
| `configurationName` | string | **Yes** | The configuration name for this pipeline run. Example: `SampleConfigName`. |
| `execution_details` | Avalara.POS.API.JMS.Models.JobExecutionDetails | No |  |
| `configurations` | Avalara.POS.API.JMS.Models.RunConfigModel+ConfigurationModel[] | **Yes** | Run configurations for each company to extract data for.
            
Can either be in the form of a fully explicit run configuration
or a configuration ID representing an existing configuration.
networkDetails only needed in case of destination = exavault |
| `jobType` | string | **Yes** | Specify the job type.

Values: `Production`, `Test` Example: `Production`. |
| `output_type` | string | **Yes** | Specify the output type.

Values: `Full` for a full run or `Differences only` for changes.

- `Full`: Run a full job. This downloads the all of the associated tax content for use with your point of sale (POS) system.
- `Differences only`: Retrieve just the changes in a job. This creates a file that identifies the differences in tax content between two job runs. 
   You can compare the output between a new and a previous job run or between two previous job runs. Requires `base_run_id` to be set. Example: `Full`. |
| `base_run_id` | string | No | When running a `Differences only` job, specify the base run ID for the job you want to compare this to. Example: `00000000-0000-0000-0000-000000000000`. |
| `productType` | string | No | productType used to differenciate between ATC products default(retail), lodging, managers. Example: `default`. |
| `prebuiltTemplate` | Avalara.POS.API.JMS.Models.PrebuiltTemplate | No |  |

**Content-Type:** `application/*+json`
**Schema:** `Avalara.POS.API.JMS.Models.RunConfigModel`

Represents a configuration for a new Content Extract Pipeline run.

| Property | Type | Required | Description |
|---|---|---|---|
| `name` | string | **Yes** | Specify a name for this pipeline run. Example: `SampleJob`. |
| `jobId` | string | **Yes** | Specify an ID for this job. This ID can be used to retrieve a run for a specific job. Example: `00000000-0000-0000-0000-000000000000`. |
| `configurationName` | string | **Yes** | The configuration name for this pipeline run. Example: `SampleConfigName`. |
| `execution_details` | Avalara.POS.API.JMS.Models.JobExecutionDetails | No |  |
| `configurations` | Avalara.POS.API.JMS.Models.RunConfigModel+ConfigurationModel[] | **Yes** | Run configurations for each company to extract data for.
            
Can either be in the form of a fully explicit run configuration
or a configuration ID representing an existing configuration.
networkDetails only needed in case of destination = exavault |
| `jobType` | string | **Yes** | Specify the job type.

Values: `Production`, `Test` Example: `Production`. |
| `output_type` | string | **Yes** | Specify the output type.

Values: `Full` for a full run or `Differences only` for changes.

- `Full`: Run a full job. This downloads the all of the associated tax content for use with your point of sale (POS) system.
- `Differences only`: Retrieve just the changes in a job. This creates a file that identifies the differences in tax content between two job runs. 
   You can compare the output between a new and a previous job run or between two previous job runs. Requires `base_run_id` to be set. Example: `Full`. |
| `base_run_id` | string | No | When running a `Differences only` job, specify the base run ID for the job you want to compare this to. Example: `00000000-0000-0000-0000-000000000000`. |
| `productType` | string | No | productType used to differenciate between ATC products default(retail), lodging, managers. Example: `default`. |
| `prebuiltTemplate` | Avalara.POS.API.JMS.Models.PrebuiltTemplate | No |  |

## Responses

| Status | Description | Schema |
|---|---|---|
| 201 | Created | `Avalara.POS.API.JMS.Models.RunStatusModel` |
| 400 | Bad Request | `Microsoft.AspNetCore.Mvc.ProblemDetails` |
| 401 | Unauthorized | `Microsoft.AspNetCore.Mvc.ProblemDetails` |

### 201 Response: `Avalara.POS.API.JMS.Models.RunStatusModel`

Metadata for a new Content Extract Pipeline run.

| Property | Type | Required | Description |
|---|---|---|---|
| `name` | string | No | Title of the pipeline run. Example: `SampleName`. |
| `jobId` | string | No | ID for the combined TTE configuration, delivery method, and communication method. Example: `00000000-0000-0000-0000-000000000000`. |
| `runId` | string | No | ID for the pipeline run. Example: `00000000-0000-0000-0000-000000000000`. |
| `dttId` | string | No | ID for the DTT configuration Example: `00000000-0000-0000-0000-000000000000`. |
| `status` | string | No | Status of the pipeline run.
            
Values are: `QUEUED`, `RUNNING`, `FAILURE`, `SUCCESS`. Example: `SUCCESS`. |
| `configurationName` | string | No | Configuration Name for the pipeline run. Example: `SampleConfigName`. |
| `jobType` | string | No | Job type. Example: `Production`. |
| `platform` | string | No | Platform for the pipeline run. Example: `APTOS`. |
| `started` | string | No | When the pipeline run began. |
| `completed` | string | No | When the pipeline run finished. |
| `execution_details` | Avalara.POS.API.JMS.Models.JobExecutionDetails | No |  |
| `outputtype` | string | No | Output type for the pipeline run. Example: `Full`. |
| `tteType` | string | No | TTE type for the pipeline run, 'lodging' for lodging runs. Example: `lodging`. |
| `baseRunId` | string | No | Base run ID. Example: `00000000-0000-0000-0000-000000000000`. |
| `latestRunId` | string | No | Latest run ID. Example: `00000000-0000-0000-0000-000000000000`. |
| `dttPreviewStatus` | string | No | DTT Preview status.
            
Values are: `enabled`, `disabled`, `warmup`. |
| `productType` | string | No | Product type for the pipeline run, 'lodging' for lodging runs. Example: `lodging`. |
| `countryCodes` | string[] | No | Country codes from the TTE configuration. |
| `detailLevel` | string | No | Detail level from the TTE configuration. |
| `downloadInformation` | Avalara.POS.API.Common.Models.Downloads | No |  |

## Example Request

```bash
curl -X POST "https://rest.avatax.com/api/v2/content/jobs/v1/companies/{companyId}/Runs" \
  -H "Authorization: Basic <credentials>" \
  -H "Accept: application/json" \
  -d '{
  "name": "SampleJob",
  "jobId": "00000000-0000-0000-0000-000000000000",
  "configurationName": "SampleConfigName",
  "execution_details": {
    "executionsource": "manual",
    "notes": "",
    "autoJobRunType": "",
    "VersionName": "",
    "ReleaseDate": ""
  },
  "configurations": [
    {
      "tteId": "00000000-0000-0000-0000-000000000000",
      "tteType": "lodging",
      "dttId": "00000000-0000-0000-0000-000000000000 (optional)",
      "prebuiltId": "00000000-0000-0000-0000-000000000000",
      "communicationId": "00000000-0000-0000-0000-000000000000",
      "dateRange": {
        "relativeStartDays": "",
        "relativeEndDays": ""
      },
      "deliveryConfigurations": {
        "platform": "TTE",
        "destination": "exavault",
        "networkDetails": {
          "emailAddress": "abc@xyz.com"
        },
        "notifyApiDelivery": ""
      },
      "companyId": 12345,
      "accountId": 98765
    }
  ],
  "jobType": "Production",
  "output_type": "Full",
  "base_run_id": "00000000-0000-0000-0000-000000000000",
  "productType": "default",
  "prebuiltTemplate": {
    "templateType": "",
    "templateName": "",
    "templateTypeLabel": "",
    "internalTemplateName": "",
    "templateTypeIsConfigurable": ""
  }
}'
```