> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hotglue.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Run a V2 Job

> Kicks off a job for a given tenant. Can be used to write data in target flows by passing a payload in the state object. When `queue_if_active_job` is set to true in the request body, hotglue queues the job if another job is already running for the same tenant or flow.



## OpenAPI

````yaml post /v2/{env_id}/{flow_id}/{tenant}/jobs
openapi: 3.1.0
info:
  title: hotglue API
  version: '1.2'
servers:
  - url: https://api.hotglue.com
security:
  - sec0: []
paths:
  /v2/{env_id}/{flow_id}/{tenant}/jobs:
    post:
      summary: Run a V2 Job
      description: >-
        Kicks off a job for a given tenant. Can be used to write data in target
        flows by passing a payload in the state object. When
        `queue_if_active_job` is set to true in the request body, hotglue queues
        the job if another job is already running for the same tenant or flow.
      operationId: jobs-create-v2
      parameters:
        - name: env_id
          in: path
          description: ID of environment
          schema:
            type: string
          required: true
        - name: flow_id
          in: path
          description: ID of flow
          schema:
            type: string
          required: true
        - name: tenant
          in: path
          description: ID of tenant
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - connector_id
                - job_type
              properties:
                connector_id:
                  type: string
                  description: >-
                    The ID of the connector to run a job for. Note that in V2
                    flows, you do not pass a tap or target
                job_type:
                  type: string
                  description: The schedule expression to sync on
                  enum:
                    - read
                    - write
                job_name:
                  type: string
                  description: Name for job. If not provided, name is autogenerated
                override_start_date:
                  type: string
                  description: >-
                    Date to start syncing data from (e.g.
                    2022-08-08T00:00:00.000Z)
                  format: date
                override_end_date:
                  type: string
                  description: >-
                    Date to sync data until. Only supported on some connectors.
                    (e.g. 2022-08-10T00:00:00.000Z)
                  format: date
                reset_source_state:
                  type: boolean
                  description: >-
                    Runs the job as a "full_sync" by clearing the `state` on the
                    linkedSource
                override_selected_tables:
                  type: object
                  description: >-
                    For use with the unified schema. Define a temporary
                    selection of unified schema objects to override the default
                    selection. Does not affect your selection for future jobs.
                    E.G. `{"Vendors":true}`
                override_source_config:
                  type: object
                  description: >-
                    Override the source connector configuration for this job
                    only. Does not affect the saved configuration.
                override_target_config:
                  type: object
                  description: >-
                    Override the target connector configuration for this job
                    only. Does not affect the saved configuration.
                override_connector_config:
                  type: object
                  description: >-
                    Override the bidirectional connector-level configuration for
                    this job only.
                override_field_map:
                  type: object
                  description: >-
                    Define a temporary field map to be used in the job,
                    different from the configured field map.
                environment_variables:
                  type: object
                  description: Override environment variables for the job execution.
                state:
                  type: object
                  description: >-
                    Optional extra context to be used by the job. Often used for
                    write jobs. Note that this is different from the source
                    state.
                streaming_job:
                  type: boolean
                  description: >-
                    If true, the job will run in streaming mode and skip the ETL
                    step. This feature is in beta.
                ignore_parallel_jobs:
                  type: boolean
                  description: >-
                    If true, the job will ignore restrictions on parallel job
                    execution for this connector.
                queue_if_active_job:
                  type: boolean
                  description: >-
                    If set to true, queues the job when another job is already
                    running for the same tenant or flow. If omitted or set to
                    false, the API returns an error when an active job blocks
                    creation.
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                Result:
                  value:
                    job_id: 37g_DK
                    env_id: mydomain.hotglue.xyz
                    flow_id: l8odS2mce
                    job_name: l8odS2mce-chargebee-20220119-153011
                    tenant: '12598713'
                    started_by: '12598713'
                    s3_root: 12598713/flows/l8odS2mce/jobs/2022/01/4/19/15/37g_DK
                    start_time: '2022-01-19T15:30:11.731333+00:00'
                    state: {}
                    tap: chargebee
                    status: JOB_CREATED
                    scheduled_job: true
                    message: ...
                    last_updated: '2022-01-19T15:35:13.982380+00:00'
                    processed_rows: 0
              schema:
                type: object
                properties:
                  job_id:
                    type: string
                    example: 37g_DK
                  env_id:
                    type: string
                    example: mydomain.hotglue.xyz
                  flow_id:
                    type: string
                    example: l8odS2mce
                  job_name:
                    type: string
                    example: l8odS2mce-chargebee-20220119-153011
                  tenant:
                    type: string
                    example: 12598713
                  started_by:
                    type: string
                    example: 12598713
                  s3_root:
                    type: string
                    example: 12598713/flows/l8odS2mce/jobs/2022/01/4/19/15/37g_DK
                  start_time:
                    type: string
                    example: '2022-01-19T15:30:11.731333+00:00'
                  state:
                    type: object
                    properties: {}
                  tap:
                    type: string
                    example: chargebee
                  status:
                    type: string
                    example: JOB_CREATED
                    enum:
                      - JOB_CREATED
                      - DISCOVER_STARTED
                      - DISCOVER_FAILED
                      - SYNC_STARTED
                      - SYNC_FAILED
                      - SYNC_SUCCESS
                      - ETL_STARTED
                      - ETL_FAILED
                      - ETL_SUCCESS
                      - EXPORT_STARTED
                      - EXPORT_FAILED
                      - JOB_COMPLETED
                  scheduled_job:
                    type: boolean
                    example: true
                    default: true
                  message:
                    type: string
                    example: ...
                  last_updated:
                    type: string
                    example: '2022-01-19T15:35:13.982380+00:00'
                  processed_rows:
                    type: integer
                    example: 0
                    default: 0
        '202':
          description: Job queued because another job is already running
          content:
            application/json:
              examples:
                Queued Job:
                  value:
                    message: Job has been queued. It will run when available
                    reason: There is a job currently running
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Job has been queued. It will run when available
                  reason:
                    type: string
                    example: There is a job currently running
        '400':
          description: '400'
          content:
            application/json:
              examples:
                Result:
                  value: {}
              schema:
                type: object
                properties: {}
      deprecated: false
components:
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: x-api-key

````