openapi: 3.1.0
info:
  title: Brand Jobs API
  version: v11
  description: "The Jobs API allows for scheduling data extractions and fetching results once complete. \nJobs are automatically scheduled when using endpoints like ClickExport or ReportExport. \nThe API provides status monitoring, replay capabilities, and direct result downloads.\n"
servers:
- url: https://api.impact.com
security:
- basicAuth: []
paths:
  /Advertisers/{AccountSID}/Jobs:
    get:
      operationId: listJobs
      tags:
      - Jobs
      summary: Return a list of jobs
      parameters:
      - name: AccountSID
        in: path
        required: true
        description: The unique identifier for the account.
        schema:
          type: string
      - name: CreatedAfter
        in: query
        required: false
        description: Return jobs scheduled after this date and time (ISO 8601).
        schema:
          type: string
          format: date-time
      - name: CreatedBefore
        in: query
        required: false
        description: Return jobs scheduled before this date and time (ISO 8601).
        schema:
          type: string
          format: date-time
      responses:
        '200':
          description: A list of job objects.
          content:
            application/json:
              schema:
                type: object
                properties:
                  Jobs:
                    type: array
                    description: The list of job objects.
                    items:
                      $ref: '#/components/schemas/Job'
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -L \
            --url 'https://api.impact.com/Advertisers/{AccountSID}/Jobs' \
            --user '{AccountSID}:{AuthToken}' \
            --header 'Accept: */*'
  /Advertisers/{AccountSID}/Jobs/{JobId}:
    get:
      operationId: getJob
      tags:
      - Jobs
      summary: Return a job
      description: Returns an object describing the current status and metadata of a specific job.
      parameters:
      - name: AccountSID
        in: path
        required: true
        description: The unique identifier for the account.
        schema:
          type: string
      - name: JobId
        in: path
        required: true
        description: The unique identifier for the job.
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: A single job object representing the status of the job.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Job'
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -L \
            --url 'https://api.impact.com/Advertisers/{AccountSID}/Jobs/{JobId}' \
            --user '{AccountSID}:{AuthToken}' \
            --header 'Accept: */*'
  /Advertisers/{AccountSID}/Jobs/{JobId}/Download:
    get:
      operationId: downloadJobResult
      tags:
      - Jobs
      summary: Download a job result
      description: "Downloads the result file if the job is COMPLETED. If the job is still processing, \nit returns the current status object.\n"
      parameters:
      - name: AccountSID
        in: path
        required: true
        description: The unique identifier for the account.
        schema:
          type: string
      - name: JobId
        in: path
        required: true
        description: The unique identifier for the job whose result you want to download.
        schema:
          type: string
          format: uuid
      - name: Mode
        in: query
        required: false
        description: Set to 'Stream' to stream the file directly instead of redirecting to a signed URL.
        schema:
          type: string
          enum:
          - Stream
      responses:
        '200':
          description: The job result file.
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
        '202':
          description: The job is not yet complete. The response body contains the current job status object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Job'
        '302':
          description: Redirect to a temporary signed URL for result file download.
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -L \
            --url 'https://api.impact.com/Advertisers/{AccountSID}/Jobs/{JobId}/Download' \
            --user '{AccountSID}:{AuthToken}' \
            --header 'Accept: */*'
  /Advertisers/{AccountSID}/Jobs/{JobId}/Replay:
    put:
      operationId: replayJob
      tags:
      - Jobs
      summary: Replay a job
      description: "Replays a completed, failed, or canceled job. Useful if additional results \nare expected for the original export window.\n"
      parameters:
      - name: AccountSID
        in: path
        required: true
        description: The unique identifier for the account.
        schema:
          type: string
      - name: JobId
        in: path
        required: true
        description: The unique identifier for the job to replay.
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: The job was successfully re-queued. The response body contains the new status of the replayed job.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Job'
        '403':
          description: Forbidden — the job is not in a replayable state or type.
      x-codeSamples:
      - lang: cURL
        source: |-
          curl -L \
            --request PUT \
            --url 'https://api.impact.com/Advertisers/{AccountSID}/Jobs/{JobId}/Replay' \
            --user '{AccountSID}:{AuthToken}' \
            --header 'Accept: */*'
components:
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
  schemas:
    Job:
      type: object
      properties:
        Id:
          type: string
          format: uuid
          description: The unique identifier for the job.
          example: d8807a9f-a5ee-4e3f-ad2b-3dfd19d1915f
        Type:
          type: string
          description: The type of job.
          enum:
          - DownloadReport
          - ApiReport
          - UploadAds
          - TermModification
          - ClickExport
          example: ClickExport
        ProgramId:
          type: string
          description: The Program ID (CampaignId) this job was scheduled for.
          example: '3629'
        CreatedBy:
          type: string
          description: The Account SID of the account that scheduled this job.
          example: <AccountSID>
        CreatedDate:
          type: string
          format: date-time
          description: The date and time the job was created.
          example: '2022-06-07T04:33:50-05:00'
        StartedDate:
          type: string
          format: date-time
          nullable: true
          description: The date and time the job started processing.
          example: '2022-06-07T04:33:50-05:00'
        CompletedDate:
          type: string
          format: date-time
          nullable: true
          description: The date and time the job completed successfully.
          example: '2022-06-07T04:33:50-05:00'
        AbandonedDate:
          type: string
          format: date-time
          nullable: true
          description: The date and time the job was abandoned, if applicable.
          example: '2022-06-07T04:33:50-05:00'
        CancelledDate:
          type: string
          format: date-time
          nullable: true
          description: The date and time the job was cancelled, if applicable.
          example: '2022-06-07T04:33:50-05:00'
        FailedDate:
          type: string
          format: date-time
          nullable: true
          description: The date and time the job failed, if applicable.
          example: '2022-06-07T04:33:50-05:00'
        LastProgressUpdateDate:
          type: string
          format: date-time
          nullable: true
          description: The date and time of the most recent progress update.
          example: '2022-06-07T04:33:50-05:00'
        Status:
          type: string
          description: The current status of job processing.
          enum:
          - QUEUED
          - RUNNING
          - COMPLETED
          - CANCELLED
          - ERROR
          - FAILED
          example: COMPLETED
        StatusMessage:
          type: string
          description: A message describing the current job status.
          example: Job processing completed successfully.
        RecordsProcessed:
          type: integer
          description: The number of records processed.
          example: 250
        PercentageComplete:
          type: integer
          description: The percentage of work completed.
          example: 100
        Replayable:
          type: boolean
          description: Indicates if this job type can be replayed.
          example: true
        ResultUri:
          type: string
          format: uri-reference
          nullable: true
          description: A URI pointing to the result file of a successfully completed job.
          example: /Advertisers/<AccountSID>/Jobs/d8807a9f-a5ee-4e3f-ad2b-3dfd19d1915f/Download
x-default-client: cURL
