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

# Get job by ID

> Check the status and outcome of a background job, such as an import (job type `multi-import`) or an OpenAPI Git pull or push.

Poll this endpoint - e.g. using the URL returned in the job's `links.self` - until the job's status is `COMPLETE` or `ERROR`,
at which point its `outcome` field will contain the job's result (for imports, the IDs of the created stub mappings) or errors respectively.




## OpenAPI

````yaml /api-reference/openapi.yaml get /v1/mock-apis/{mockApiId}/jobs/{jobId}
openapi: 3.1.0
info:
  title: WireMock Cloud
  description: The public API for WireMock Cloud
  contact:
    email: help@wiremock.io
  version: 1.0.0
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://wmc.wiremockapi.cloud
    description: Mock
  - url: https://api.wiremock.cloud
    description: Production
security:
  - tokenAuth: []
tags:
  - name: Users
    description: User accounts
  - name: Teams
    description: Teams
  - name: Organisations
    description: Organisations
  - name: Usage
    description: Product usage
  - name: Mock APIs
    description: Mock APIs
  - name: Mock API versioning
    description: Mock API versioning
  - name: Data sources
    description: Data sources
  - name: Database connections
    description: Database connections
  - name: Security
    description: Security
  - name: Access control
    description: Access control / authorisation
  - name: API templates
    description: API template library
  - name: Jobs
    description: Background jobs e.g. imports and OpenAPI Git pull/push
  - name: OpenAPI
    description: OpenAPI description
  - name: Settings
    description: Mock API configuration settings
  - name: Stub Mappings
    description: Operations on stub mappings
    externalDocs:
      description: User documentation
      url: https://wiremock.org/docs/stubbing/
  - name: Requests
    description: Logged requests and responses received by the mock service
    externalDocs:
      description: User documentation
      url: https://wiremock.org/docs/verifying/
  - name: Recordings
    description: Stub mapping record and snapshot functions
    externalDocs:
      description: User documentation
      url: https://wiremock.org/docs/record-playback/
  - name: State
    description: Scenarios support modelling of stateful behaviour
    externalDocs:
      description: User documentation
      url: https://wiremock.org/docs/stateful-behaviour/
  - name: Imports
    description: Importing into your mock API
  - name: Mock Hosts
    description: Mock API hosts
paths:
  /v1/mock-apis/{mockApiId}/jobs/{jobId}:
    parameters:
      - $ref: '#/components/parameters/mockApiId'
    get:
      tags:
        - Jobs
      summary: Get job by ID
      description: >
        Check the status and outcome of a background job, such as an import (job
        type `multi-import`) or an OpenAPI Git pull or push.


        Poll this endpoint - e.g. using the URL returned in the job's
        `links.self` - until the job's status is `COMPLETE` or `ERROR`,

        at which point its `outcome` field will contain the job's result (for
        imports, the IDs of the created stub mappings) or errors respectively.
      operationId: getJobById
      parameters:
        - name: jobId
          in: path
          required: true
          style: simple
          explode: false
          schema:
            type: string
            format: uuid
          example: 8e2f3641-5f0a-45a2-9d1b-39cf16b2d0e7
      responses:
        '200':
          description: The job's current state
          content:
            application/json:
              schema:
                required:
                  - job
                type: object
                properties:
                  job:
                    $ref: '#/components/schemas/job'
              examples:
                Import job complete:
                  value:
                    job:
                      id: 8e2f3641-5f0a-45a2-9d1b-39cf16b2d0e7
                      jobType: multi-import
                      status: COMPLETE
                      started: '2024-09-05T10:20:46.143759190Z'
                      finished: '2024-09-05T10:21:02.200386224Z'
                      elapsed: PT16.056627034S
                      links:
                        self: >-
                          /v1/mock-apis/0ozge/jobs/8e2f3641-5f0a-45a2-9d1b-39cf16b2d0e7
                      outcome:
                        mappings:
                          - id: 7e6d6733-881e-416d-9f6c-bad8d5015d0f
                          - id: 2791b6fe-bbbe-4102-a3fd-721fb9ba1557
                  x-parameter-values:
                    mockApiId: 0ozge
                    jobId: 8e2f3641-5f0a-45a2-9d1b-39cf16b2d0e7
                Git pull job failed:
                  value:
                    job:
                      id: 5947aff3-947b-4dfb-90f5-d324684e97db
                      jobType: open-api-git-pull
                      status: ERROR
                      started: '2024-09-05T10:20:46.143759190Z'
                      links:
                        self: >-
                          /v1/mock-apis/0ozge/jobs/5947aff3-947b-4dfb-90f5-d324684e97db
                      finished: '2024-09-05T10:20:46.200386224Z'
                      elapsed: PT0.056627034S
                      outcome:
                        errorCode: NO_LOCAL_HEAD
                        errors:
                          - code: 112
                            title: No previous pull
                            detail: This is the first time pulling from Git.
                  x-parameter-values:
                    mockApiId: 0ozge
                    jobId: 5947aff3-947b-4dfb-90f5-d324684e97db
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '404':
          $ref: '#/components/responses/404'
components:
  parameters:
    mockApiId:
      in: path
      name: mockApiId
      description: The ID of the Mock API
      required: true
      schema:
        $ref: '#/components/schemas/IdSchema'
  schemas:
    job:
      name: job
      description: A background job, such as an import or an OpenAPI Git pull or push
      type: object
      properties:
        id:
          description: The job's unique ID
          type: string
          format: uuid
        jobType:
          description: The type of the job
          type: string
          enum:
            - multi-import
            - open-api-git-pull
            - open-api-git-push
            - load-api-template
          example: multi-import
        status:
          description: >-
            The current status of the job. RUNNING jobs have not yet finished,
            so their outcome is not yet available
          type: string
          enum:
            - RUNNING
            - COMPLETE
            - ERROR
        started:
          description: When the job started
          type: string
          format: date-time
        finished:
          description: >-
            When the job finished. Present once the job has reached COMPLETE or
            ERROR status
          type: string
          format: date-time
        elapsed:
          description: >-
            Total job duration in ISO 8601 duration format. Present once the job
            has reached COMPLETE or ERROR status
          type: string
          example: PT1.256627034S
        links:
          type: object
          properties:
            self:
              description: >-
                Path of the job status endpoint, which can be polled until the
                job reaches COMPLETE or ERROR status
              type: string
          required:
            - self
        outcome:
          description: >-
            The result of the job. Present once the job has reached COMPLETE or
            ERROR status. For multi-import jobs this contains the import result
            on COMPLETE status, or the errors on ERROR status.
          type: object
      required:
        - id
        - jobType
        - status
        - started
        - links
    IdSchema:
      type: string
      minLength: 5
      maxLength: 10
      example: jjl8y
    Errors:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/SingleError'
      required:
        - errors
    SingleError:
      type: object
      properties:
        code:
          type: number
        title:
          type: string
        detail:
          type: string
        source:
          type: object
      required:
        - title
  responses:
    '400':
      description: 400 Bad Request response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Errors'
          example:
            errors:
              - title: Invalid query parameter format
                detail: The offset parameter value must be a positive integer
    '401':
      description: 401 Unauthenticated response
      content:
        text/plain:
          schema:
            type: string
          example: Credentials are required to access this resource.
    '404':
      description: 404 Not Found response
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: integer
              message:
                type: string
            required:
              - message
          example:
            code: 404
            message: HTTP 404 Not Found
  securitySchemes:
    tokenAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Your [API key](https://app.wiremock.cloud/account/security) prefixed by
        'Token '

````