> For the complete documentation index, see [llms.txt](https://developer.emporix.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.emporix.io/api-references-1/readme/api-reference-19/invoice-jobs.md).

# Invoice Jobs

## Creating a job that starts an invoice creation

> Endpoint for creating a job that triggers invoice creation. There are two types of jobs: manual and automatic.\
> \* Manual - takes \`orderIds\` from which the invoices should be created. The \`orderIds\` come from the request payload.\
> \* Automatic - performs a query to find orders that are ready for invoice generation based on configured parameters. The query parameters are defined in configuration service.<br>

```json
{"openapi":"3.0.0","info":{"title":"Invoice Service","version":"1.0.0"},"tags":[{"name":"Invoice Jobs"}],"servers":[{"url":"https://api.emporix.io"}],"paths":{"/invoice/{tenant}/jobs/invoices":{"post":{"summary":"Creating a job that starts an invoice creation","tags":["Invoice Jobs"],"description":"Endpoint for creating a job that triggers invoice creation. There are two types of jobs: manual and automatic.\n* Manual - takes `orderIds` from which the invoices should be created. The `orderIds` come from the request payload.\n* Automatic - performs a query to find orders that are ready for invoice generation based on configured parameters. The query parameters are defined in configuration service.\n","operationId":"POST-invoice-create-job","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobRequest"}}}},"responses":{"201":{"description":"Invoices job created. The job ID is returned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobCreationResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"JobRequest":{"type":"object","properties":{"orderIds":{"type":"array","description":"A list of order IDs for which the invoices should be created.","items":{"type":"string"}},"jobType":{"enum":["AUTOMATIC","MANUAL"],"type":"string","description":"A job type determines if the orders are searched automatically based on parameters configured in configuration service or are manually provided in orderIds array."}},"required":["jobType"]},"JobCreationResponse":{"type":"object","properties":{"jobId":{"type":"string","description":"The created job ID."}}},"ErrorResponse":{"type":"object","properties":{"message":{"type":"string","description":"A descriptive error message for debugging."},"code":{"type":"string","description":"Original HTTP error code. It should be consistent with the HTTP response code."},"detailInfo":{"type":"string","description":"More details about the error (if available)."}}}}}}
```

## Returning a job status and order details

> Returns the job status and details about the processed orders.

```json
{"openapi":"3.0.0","info":{"title":"Invoice Service","version":"1.0.0"},"tags":[{"name":"Invoice Jobs"}],"servers":[{"url":"https://api.emporix.io"}],"paths":{"/invoice/{tenant}/jobs/invoices/{jobId}":{"get":{"summary":"Returning a job status and order details","tags":["Invoice Jobs"],"description":"Returns the job status and details about the processed orders.","operationId":"GET-invoice-retrieve-job-and-order","responses":{"200":{"description":"Returned when job exists","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobStatusResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Returned when a job doesn't exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"JobStatusResponse":{"type":"object","properties":{"jobStatus":{"description":"Status of the processed job. Possible values: `DONE`,` IN_PROGRESS`","enum":["DONE","IN_PROGRESS"],"type":"string"},"jobType":{"description":"Job type determines if the orders are provided manually or searched by a parametrized query.","enum":["AUTOMATIC","MANUAL"],"type":"string"},"orders":{"type":"array","items":{"type":"object","properties":{"orderId":{"description":"The ID of the processed order.","type":"string"},"orderStatus":{"description":"Status determining if the order was processed successfully.","enum":["SUCCESS","FAILURE","PENDING"],"type":"string"},"message":{"description":"Information about the result of order processing.","type":"string"},"downloadLink":{"description":"URL to the generated invoice PDF.","type":"string"},"invoiceNumber":{"description":"Number of the generated invoice.","type":"string"}}}}}},"ErrorResponse":{"type":"object","properties":{"message":{"type":"string","description":"A descriptive error message for debugging."},"code":{"type":"string","description":"Original HTTP error code. It should be consistent with the HTTP response code."},"detailInfo":{"type":"string","description":"More details about the error (if available)."}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.emporix.io/api-references-1/readme/api-reference-19/invoice-jobs.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
