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

# get a job execution status

> Returns a **job** execution current **state**. Depending on the **state**, a **report** specifying the operations processing details is accessible.

The **job** execution **report** is only accessible during 21 days after its submission.

You can use the view parameter to define the level of detail you need :

- *OVERVIEW* for basic information
- *DETAILS* for detailed information about the job

**Example 1 : Job execution report -> overview**
```json
{
  "archive": "contracts.tar.gz",
  "state": {
    "current": "DONE",
    "history": [
      {
        "status": "SUBMITTED",
        "ts": "2026-03-18T15:12:55Z"
      },
      //...
    ]
  },
  "report": {
    "overview": {
      "nbOperationsTotal": 100,
      "nbOperationsOK": 100,
      "nbOperationsKO": 0
    }
  },
  "_links": {
    //...
  }
}
```


**Example 2 : Job execution report -> details**
```json
{
  "archive": "contracts.tar.gz",
  "state": {
    "current": "DONE",
    "history": [
      {
        "status": "SUBMITTED",
        "ts": "2026-03-18T15:12:55Z"
      },
      //...
    ]
  },
  "report": {
    "overview": {
      "nbOperationsTotal": 100,
      "nbOperationsOK": 100,
      "nbOperationsKO": 0
    },
    "files": [
      {
        "file": "contracts_1.json",
        "content": {
          "elecStatus": [
            {
              "status": [
                {
                  "code": "OK"
                }
              ],
              "siteId": "fbabb71e-7d2b-4d49-9d03-f17581e70ffd",
              "podId": "pdlfd112c3e-28",
              "ts": "2026-03-01T23:00:00Z",
              "generationTs": "2026-03-02T23:00:00Z"
            },
            //...
          ]
        }
      }
    ]
  },
  "_links": {
    //...
  }
}
```



## OpenAPI

````yaml /api-reference/contracts.yaml get /contracts-jobs/{job-id}
openapi: 3.0.3
info:
  title: Contracts lifecycle
  description: >
    This API manages the lifecycle of contracts associated to a PoD.


    Contract key concepts:

    - A contract is applicable starting it ts value and ends with the next
    contract beginning

    - The definition of an existing contract can be updated using the ts and
    generationTs fields
  termsOfService: TODO
  contact:
    email: api@datanumia.com
  version: 2.0.0
servers:
  - url: https://api.home.datanumia.com/api/v2
    description: Production Server
security: []
paths:
  /contracts-jobs/{job-id}:
    get:
      tags:
        - bulk mode contracts
      summary: get a job execution status
      description: >-
        Returns a **job** execution current **state**. Depending on the
        **state**, a **report** specifying the operations processing details is
        accessible.


        The **job** execution **report** is only accessible during 21 days after
        its submission.


        You can use the view parameter to define the level of detail you need :


        - *OVERVIEW* for basic information

        - *DETAILS* for detailed information about the job


        **Example 1 : Job execution report -> overview**

        ```json

        {
          "archive": "contracts.tar.gz",
          "state": {
            "current": "DONE",
            "history": [
              {
                "status": "SUBMITTED",
                "ts": "2026-03-18T15:12:55Z"
              },
              //...
            ]
          },
          "report": {
            "overview": {
              "nbOperationsTotal": 100,
              "nbOperationsOK": 100,
              "nbOperationsKO": 0
            }
          },
          "_links": {
            //...
          }
        }

        ```



        **Example 2 : Job execution report -> details**

        ```json

        {
          "archive": "contracts.tar.gz",
          "state": {
            "current": "DONE",
            "history": [
              {
                "status": "SUBMITTED",
                "ts": "2026-03-18T15:12:55Z"
              },
              //...
            ]
          },
          "report": {
            "overview": {
              "nbOperationsTotal": 100,
              "nbOperationsOK": 100,
              "nbOperationsKO": 0
            },
            "files": [
              {
                "file": "contracts_1.json",
                "content": {
                  "elecStatus": [
                    {
                      "status": [
                        {
                          "code": "OK"
                        }
                      ],
                      "siteId": "fbabb71e-7d2b-4d49-9d03-f17581e70ffd",
                      "podId": "pdlfd112c3e-28",
                      "ts": "2026-03-01T23:00:00Z",
                      "generationTs": "2026-03-02T23:00:00Z"
                    },
                    //...
                  ]
                }
              }
            ]
          },
          "_links": {
            //...
          }
        }

        ```
      operationId: getBulkContractsDetailedExecutionStatus
      parameters:
        - name: job-id
          in: path
          description: Id of the requested job
          required: true
          schema:
            type: string
        - name: view
          in: query
          description: >
            The level of details requested for the report :

            - OVERVIEW: job execution state (current & history) and operations
            status overview

            - DETAILS: OVERVIEW + detailed status at the operation level
          schema:
            type: string
            enum:
              - overview
              - details
            default: overview
      responses:
        '200':
          description: Job detail in success
          content:
            application/octet-stream:
              schema:
                $ref: '#/components/schemas/BulkContractDetailedExecutionStatus'
            application/json:
              schema:
                $ref: '#/components/schemas/BulkContractDetailedExecutionStatus'
        '400':
          description: "Functional error. Possible values:\r\n\r\nERROR CODE | ERROR CASE\r\n-----------|-----------\r\nILLEGAL_ARGUMENT | Invalid UUID format\r\n\r\nThis list can be expanded over time."
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content: {}
        '404':
          description: "Functional error. Possible values:\r\n\r\nERROR CODE | ERROR CASE\r\n-----------|-----------\r\nJOB_NOT_FOUND | UUID format is valid but no job exists for this value\r\n"
          content: {}
        '500':
          description: Server error
          content: {}
      security:
        - Bearer:
            - home:elec-contracts:jobs:read home:gas-contracts:jobs:read
components:
  schemas:
    BulkContractDetailedExecutionStatus:
      required:
        - _links
        - archive
        - state
      type: object
      properties:
        _links:
          $ref: '#/components/schemas/JobContractLinks'
        archive:
          type: string
          description: |
            Name of the archive associated with this job execution.
          example: myOperationsArchive.tar.gz
        state:
          $ref: '#/components/schemas/BulkContractExecutionState'
        report:
          $ref: '#/components/schemas/BulkContractDetailExecutionReport'
    ErrorResponse:
      required:
        - errorCode
        - errorDescription
      type: object
      properties:
        errorCode:
          description: The error code.
          type: string
        errorDescription:
          type: string
          description: The error description
      description: ErrorResponse
    JobContractLinks:
      required:
        - self
      type: object
      properties:
        self:
          $ref: '#/components/schemas/JobContractLinkSelf'
    BulkContractExecutionState:
      type: object
      properties:
        current:
          type: string
          description: >
            Current state of the bulk job


            State | Description

            ------|--------

            SUBMITTED |The archive is received but processing has not started

            IN_PROGRESS | The archive is being processed.

            DONE | Archive processing is completed without errors and a detailed
            report on each operation is accessible.

            ERROR | Archive processing is completed but has encountered at least
            one functional or internal error. The details are available in the
            detailed report. Actions on the customer's side are necessary to
            correct them and resend the corresponding contracts.

            INTERNAL_ERROR | Archive processing was interrupted due to a series
            of internal errors that occurred while processing a JSON file.
            Actions are required on Datanumia's side to correct these errors.

            DELETED | Archive has been deleted. Detailed status report is no
            more available
          enum:
            - ERROR
            - DONE
            - IN_PROGRESS
            - SUBMITTED
            - INTERNAL_ERROR
            - DELETED
        history:
          $ref: '#/components/schemas/ExecutionContractStateHistory'
    BulkContractDetailExecutionReport:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ErrorContractDescriptionJob'
        overview:
          $ref: '#/components/schemas/ExecutionContractReportOverview'
        files:
          type: array
          items:
            $ref: '#/components/schemas/BulkContractDetailExecutionFileReport'
    JobContractLinkSelf:
      required:
        - href
      type: object
      properties:
        href:
          type: string
          example: https://<DATANUMIA_ROOT_URL>/contracts-jobs/{job-id}
    ExecutionContractStateHistory:
      type: object
      description: Job state change history
      example: |
        {
          "SUBMITTED"   : "2017-07-21T17:32:28Z",
          "IN_PROGRESS" : "2017-07-21T17:34:28Z",
          "DONE"        : "2017-07-21T17:34:58Z"
        }
      additionalProperties:
        $ref: '#/components/schemas/ExecutionContractStateMapItem'
    ErrorContractDescriptionJob:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          enum:
            - INVALID_ARCHIVE_FORMAT
            - TOO_MANY_FILES
            - INTERNAL_ERROR
          description: "\r\nError code | Error case \r\n---------|----------\r\nINVALID_ARCHIVE_FORMAT | Archive format must be .tar.gz\r\nTOO_MANY_FILES | The archive must contain between 1 and 10 JSON files\r\nINTERNAL_ERROR | Archive processing was interrupted due to a series of internal errors that occurred while processing a JSON file. Actions are required on Datanumia's side to correct these errors."
        message:
          type: string
          description: Error message
    ExecutionContractReportOverview:
      properties:
        nbOperationsTotal:
          type: integer
          description: |
            Number of executed contract operations
          example: 146
        nbOperationsOK:
          type: integer
          description: |
            Number of succeed operations
          example: 146
        nbOperationsKO:
          type: integer
          description: |
            Number of failed operations
          example: 0
    BulkContractDetailExecutionFileReport:
      type: object
      properties:
        file:
          type: string
          description: File name in the archive
          example: test.json
        error:
          $ref: '#/components/schemas/ErrorContractDescriptionFile'
        content:
          $ref: '#/components/schemas/BulkContractDetailExecutionFileReportContent'
    ExecutionContractStateMapItem:
      type: object
      properties:
        jobState:
          type: string
          description: >
            State of the bulk job


            State | Description

            ------|--------

            SUBMITTED |The archive is received but processing has not started

            IN_PROGRESS | The archive is being processed.

            DONE | Archive processing is completed without errors and a detailed
            report on each operation is accessible.

            ERROR | Archive processing is completed but has encountered at least
            one functional or internal error. The details are available in the
            detailed report. Actions on the customer's side are necessary to
            correct them and resend the corresponding contracts.

            INTERNAL_ERROR | Archive processing was interrupted due to a series
            of internal errors that occurred while processing a JSON file.
            Actions are required on Datanumia's side to correct these errors.

            DELETED | Archive has been deleted. Detailed status report is no
            more available
          enum:
            - ERROR
            - DONE
            - IN_PROGRESS
            - SUBMITTED
          example: IN_PROGRESS
        ts:
          type: string
          description: >
            Timestamp of the state  change in Home as defined by RFC 3339,
            section 5.6 using the following format: full-date'T'partial-time'Z'
          format: date-time
          example: '2017-07-21T17:32:28Z'
    ErrorContractDescriptionFile:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          enum:
            - INVALID_FILE_FORMAT
            - TOO_MANY_OPERATIONS
            - INTERNAL_ERROR
          description: "Error code | Error case \r\n---------|----------\r\nINVALID_FILE_FORMAT | File must be in JSON format\r\nTOO_MANY_OPERATIONS | Each JSON file can contain up to 10 000 contracts\r\nINTERNAL_ERROR | File processing is interrupted to prevent disruption to production systems because 15 INTERNAL_ERROR errors occured within a sliding window of 20 operations. Datanumia intervention is required to resolve this issue."
        message:
          type: string
          description: Error message
    BulkContractDetailExecutionFileReportContent:
      type: object
      properties:
        elecStatus:
          type: array
          items:
            $ref: '#/components/schemas/ContractBulkStatus'
    ContractBulkStatus:
      type: object
      required:
        - ids
        - podId
        - ts
        - generationTs
        - status
      properties:
        ids:
          $ref: '#/components/schemas/SiteAndPersonIds'
        podId:
          type: string
          example: pdl-38
          description: Id of the point of delivery
        ts:
          type: string
          format: date-time
          example: '2021-07-21T22:00:00Z'
          description: >-
            Effective date of the contract, whether it is a new contract or an
            amendment to a previously submitted contract.


            The supported format is as defined by RFC 3339, section 5.6
            restricted to : full-date'T'partial-time'Z'
        generationTs:
          type: string
          format: date-time
          example: '2022-05-17T14:28:37Z'
          description: "Date used to historize contracts for a given ts.\r\n\r\nThe supported format is as defined by RFC 3339, section 5.6 restricted to : full-date'T'partial-time'Z'"
        status:
          $ref: '#/components/schemas/Status'
    SiteAndPersonIds:
      type: object
      required:
        - personCustomerId
        - siteCustomerId
      properties:
        personCustomerId:
          type: string
          example: person-customer-id-1234
          description: Customer id of the person
        siteCustomerId:
          type: string
          example: site-customer-id-978
          description: Customer id of the site
        siteId:
          type: string
          example: site-home-id-451
          description: Datanumia id for the site
    Status:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          example: FIELD_IS_MANDATORY
          description: Error code
        message:
          type: string
          description: Error message
          example: podId is mandatory
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

````