# Orders

## Get all orders

> \
> This method retrieves a list of all external orders along with their details, such as order numbers, priority, client information, and timestamps.<br>

```json
{"openapi":"3.0.0","info":{"title":"Public API","version":"1.0"},"security":[{"PublicApiKey":[]}],"components":{"securitySchemes":{"PublicApiKey":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"PublicOrderResponseDto":{"type":"object","properties":{"id":{"type":"string","description":"Unique internal identifier of the order"},"external_order_number":{"type":"object","nullable":true,"description":"A unique string used in the UI and controlled by the user"},"marketplace_order_number":{"type":"object","nullable":true,"description":"A unique string used in the UI and controlled by the user"},"external_order_id":{"type":"object","nullable":true,"description":"A unique identifier for each order from external system"},"order_key":{"type":"string","description":"System-generated order key for internal reference"},"comment":{"type":"object","nullable":true,"description":"Additional comments or info for the order"},"to_stock":{"type":"boolean","description":"Indicates if this is an internal company order (e.g., to replenish warehouse stocks)"},"is_deleted":{"type":"boolean","description":"Indicates whether the order has been marked as deleted"},"priority":{"type":"string","description":"Priority level of the order","enum":["Highest","High","Medium","Low","Lowest"]},"client_id":{"type":"object","nullable":true,"description":"Unique identifier of the associated client"},"counterparty_id":{"type":"object","nullable":true,"description":"Unique identifier of the associated counterparty"},"created_at":{"type":"string","description":"Timestamp when the order was created","format":"date-time"}},"required":["id","external_order_number","marketplace_order_number","external_order_id","order_key","comment","to_stock","is_deleted","priority","client_id","counterparty_id","created_at"]}}},"paths":{"/api/v1/public/orders":{"get":{"description":"\nThis method retrieves a list of all external orders along with their details, such as order numbers, priority, client information, and timestamps.\n","operationId":"PublicOrdersController_getAll_v1","parameters":[{"name":"x-tenant-id","in":"header","description":"Tenant id (uuid v4)","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PublicOrderResponseDto"}}}}},"429":{"description":"Returned when the rate limit is exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum number of allowed requests during the current window","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining number of requests before throttling occurs","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Number of seconds until the rate limit window resets","schema":{"type":"integer"}}}}},"summary":"Get all orders","tags":["Orders"]}}}}
```

## Create order

> \
> This method allows creating a new order, setting order properties, and adding order items. Production items are automatically generated based on the order items' quantity.\
> \
> \### Notes\
> \
> \- If the \`line\_item\_id\` is not provided in the request, HESH generates it and includes it in the response.\
> \
> \- If the \`line\_item\_id\` is provided, HESH uses it and includes the same ID in the response.\
> \
> \### How to check transfered data in HESH\
> \
> \#### Register in Hesh\
> \
> 1\. Go to your success manager and provide registration email\
> 2\. Receive invitation on the email  \
> 3\. Create a password and log in\
> \
> \#### Open Production Page\
> \
> 1\. If you don't have "Production" page in the sidebar or don't have access contact your success manager\
> \
> \#### Filter Productions\
> \
> 1\. Choose "Source" filter\
> 2\. Filter productions by External type\
> \
> \#### Sort Productions\
> \
> Sort productions by date, deadline and so on<br>

```json
{"openapi":"3.0.0","info":{"title":"Public API","version":"1.0"},"security":[{"PublicApiKey":[]}],"components":{"securitySchemes":{"PublicApiKey":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"PublicOrderCreateDto":{"type":"object","properties":{"external_order_number":{"type":"string","description":"A unique string used in the UI and controlled by the user"},"external_order_id":{"type":"string","description":"A unique identifier for each order"},"marketplace_order_number":{"type":"string","description":"A unique string used in the UI and controlled by the user"},"comment":{"type":"string","description":"Additional comments or info for the order"},"deadline_at":{"type":"string","description":"The date when the order should be produced (ISO 8601 format)","format":"date-time"},"external_created_at":{"type":"string","description":"The date when the order was created in an external system (ISO 8601 format)","format":"date-time"},"to_stock":{"type":"boolean","description":"Indicates if this is an internal company order (e.g., to replenish warehouse stocks)"},"client":{"description":"Client information","allOf":[{"$ref":"#/components/schemas/PublicClientCreateDto"}]},"primary_client":{"description":"Primary client information","allOf":[{"$ref":"#/components/schemas/PublicClientCreateDto"}]},"line_items":{"description":"List of line items for the order","type":"array","items":{"$ref":"#/components/schemas/CreateLineItemDto"}}},"required":["external_order_number","external_order_id","line_items"]},"PublicClientCreateDto":{"type":"object","properties":{"name":{"type":"string","description":"Client name"},"external_client_id":{"type":"string","description":"External client identifier"},"phone":{"type":"object","nullable":true,"description":"Client's phone number"},"email":{"type":"object","nullable":true,"description":"Client's email"},"company":{"type":"object","nullable":true,"description":"Client's company name"}},"required":["name","external_client_id"]},"CreateLineItemDto":{"type":"object","properties":{"line_item_id":{"type":"string","description":"Line item ID"},"barcode":{"type":"string","description":"Barcode of the item"},"deadline_at":{"format":"date-time","type":"string","description":"Deadline date and time"},"planned_start_date":{"format":"date-time","type":"string","description":"Planned start date and time"},"external_created_at":{"format":"date-time","type":"string","description":"External created date and time"},"external_user_id":{"type":"string","description":"User id from external(yours) system"},"shipping_deadline":{"format":"date-time","type":"string","description":"Shipping deadline date and time"},"quantity":{"type":"number","minimum":0,"description":"Quantity of items"},"line_item_note":{"type":"string","description":"Note or comment for the line item"},"tags":{"description":"Tags for the line item","type":"array","items":{"type":"string"}},"attachments":{"description":"Attachments for the line item","type":"array","items":{"$ref":"#/components/schemas/PublicAddAttachmentToLineItemDto"}}},"required":["barcode","quantity"]},"PublicAddAttachmentToLineItemDto":{"type":"object","properties":{"file_name":{"type":"string","description":"File name"},"url":{"type":"string","description":"URL of the file"},"is_primary":{"type":"boolean","description":"Marks image as primary line item image"}},"required":["url"]},"PublicOrderCreateAndUpdateResponseDto":{"type":"object","properties":{"id":{"type":"string","description":"Unique internal identifier of the order"},"external_order_number":{"type":"string","description":"A unique string used in the UI and controlled by the user"},"order_key":{"type":"string","description":"System-generated order key for internal reference"},"external_order_id":{"type":"string","description":"A unique identifier for each order from external system"},"marketplace_order_number":{"type":"object","nullable":true,"description":"A unique string used in the UI and controlled by the user"},"marketplace_note":{"type":"object","nullable":true,"description":"Additional comments or info for the order"},"line_items":{"description":"List of line items associated with the order","type":"array","items":{"$ref":"#/components/schemas/LineItemDto"}}},"required":["id","external_order_number","order_key","external_order_id","marketplace_order_number","marketplace_note","line_items"]},"LineItemDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"line_item_id":{"type":"string","format":"uuid"},"barcode":{"type":"string"},"sku":{"type":"string"},"name":{"type":"string"},"quantity":{"type":"number"},"line_item_note":{"type":"string"},"productions":{"type":"array","items":{"$ref":"#/components/schemas/ProductionWithinLineItemDto"}}},"required":["id","line_item_id","barcode","quantity","productions"]},"ProductionWithinLineItemDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"production_key":{"type":"string"},"created_at":{"format":"date-time","type":"string"}},"required":["id","production_key","created_at"]}}},"paths":{"/api/v1/public/orders":{"post":{"description":"\nThis method allows creating a new order, setting order properties, and adding order items. Production items are automatically generated based on the order items' quantity.\n\n### Notes\n\n- If the `line_item_id` is not provided in the request, HESH generates it and includes it in the response.\n\n- If the `line_item_id` is provided, HESH uses it and includes the same ID in the response.\n\n### How to check transfered data in HESH\n\n#### Register in Hesh\n\n1. Go to your success manager and provide registration email\n2. Receive invitation on the email  \n3. Create a password and log in\n\n#### Open Production Page\n\n1. If you don't have \"Production\" page in the sidebar or don't have access contact your success manager\n\n#### Filter Productions\n\n1. Choose \"Source\" filter\n2. Filter productions by External type\n\n#### Sort Productions\n\nSort productions by date, deadline and so on\n","operationId":"PublicOrdersController_create_v1","parameters":[{"name":"x-tenant-id","in":"header","description":"Tenant id (uuid v4)","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicOrderCreateDto"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicOrderCreateAndUpdateResponseDto"}}}},"429":{"description":"Returned when the rate limit is exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum number of allowed requests during the current window","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining number of requests before throttling occurs","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Number of seconds until the rate limit window resets","schema":{"type":"integer"}}}}},"summary":"Create order","tags":["Orders"]}}}}
```

## Get order by external order id

> \
> This method retrieves an order along with their details, such as order numbers, priority, client information, line items and timestamps by provided external order id.<br>

```json
{"openapi":"3.0.0","info":{"title":"Public API","version":"1.0"},"security":[{"PublicApiKey":[]}],"components":{"securitySchemes":{"PublicApiKey":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"PublicOrderCreateAndUpdateResponseDto":{"type":"object","properties":{"id":{"type":"string","description":"Unique internal identifier of the order"},"external_order_number":{"type":"string","description":"A unique string used in the UI and controlled by the user"},"order_key":{"type":"string","description":"System-generated order key for internal reference"},"external_order_id":{"type":"string","description":"A unique identifier for each order from external system"},"marketplace_order_number":{"type":"object","nullable":true,"description":"A unique string used in the UI and controlled by the user"},"marketplace_note":{"type":"object","nullable":true,"description":"Additional comments or info for the order"},"line_items":{"description":"List of line items associated with the order","type":"array","items":{"$ref":"#/components/schemas/LineItemDto"}}},"required":["id","external_order_number","order_key","external_order_id","marketplace_order_number","marketplace_note","line_items"]},"LineItemDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"line_item_id":{"type":"string","format":"uuid"},"barcode":{"type":"string"},"sku":{"type":"string"},"name":{"type":"string"},"quantity":{"type":"number"},"line_item_note":{"type":"string"},"productions":{"type":"array","items":{"$ref":"#/components/schemas/ProductionWithinLineItemDto"}}},"required":["id","line_item_id","barcode","quantity","productions"]},"ProductionWithinLineItemDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"production_key":{"type":"string"},"created_at":{"format":"date-time","type":"string"}},"required":["id","production_key","created_at"]}}},"paths":{"/api/public/orders/{external_order_id}":{"get":{"description":"\nThis method retrieves an order along with their details, such as order numbers, priority, client information, line items and timestamps by provided external order id.\n","operationId":"PublicOrdersController_getOrder","parameters":[{"name":"external_order_id","required":true,"in":"path","schema":{"type":"string"}},{"name":"x-tenant-id","in":"header","description":"Tenant id (uuid v4)","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicOrderCreateAndUpdateResponseDto"}}}},"429":{"description":"Returned when the rate limit is exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum number of allowed requests during the current window","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining number of requests before throttling occurs","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Number of seconds until the rate limit window resets","schema":{"type":"integer"}}}}},"summary":"Get order by external order id","tags":["Orders"]}}}}
```

## Update order

> \
> This method allows to update order properties and separate order lines with new values. Any property not provided will be left unchanged.\
> \
> \*\*Scenarios for processing the received data\*\*\
> \
> \*\*📝 Amount updated\*\*\
> \
> \- the quantity is increased (past quantity>new quantity)\
> \
> The system counts by how many units the quantity of the product has increased and adds a separate production item to the order for each unit of the difference\
> \
> \- the number is decreased (past quantity\<new quantity)\
> \
> The system counts by how many units the quantity of the product has decreased and selects difference number with non-started productions among all in the specified order and cancels them\
> \
> If decreased difference more than number of non-started productions then system find not finished productions with low production priority and then the smallest progress bar and stops them. \
> \
> \*\*📝 Quantity is zero\*\*\
> \
> If you enter zero in the \`quantity\` value in the body of the query, the system will cancel all productions in \`To Do\` status and stop all productions in \`In Progress\` status of this line item with the specified characteristic. This way, a certain number of created productions with the specified parameters are canceled/stopped within one order.\
> \
> \*\*📝 Line item is missed in request body\*\*\
> \
> Productions are not in finished states - the system cancels all productions from this order with specified barcodes. Updates the deadline for the whole order according to the most short term deadline of the item in it.\
> \
> \*\*📝 Deadline updated\*\*\
> \
> System checks deadlines for each production item with the same barcode in specified order and rewrites them, saving the history and marks that changes were made by external system Updates deadline for the whole order according to the most short term deadline of the item in it.<br>

```json
{"openapi":"3.0.0","info":{"title":"Public API","version":"1.0"},"security":[{"PublicApiKey":[]}],"components":{"securitySchemes":{"PublicApiKey":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"PublicOrderUpdateDto":{"type":"object","properties":{"external_order_number":{"type":"string","description":"A unique string used in the UI and controlled by the user"},"marketplace_order_number":{"type":"string","description":"A unique string used in the UI and controlled by the user"},"comment":{"type":"string","description":"Additional comments or info for the order"},"deadline_at":{"type":"string","description":"The date when the order should be produced (ISO 8601 format)","format":"date-time"},"external_created_at":{"type":"string","description":"The date when the order was created in an external system (ISO 8601 format)","format":"date-time"},"to_stock":{"type":"boolean","description":"Indicates if this is an internal company order (e.g., to replenish warehouse stocks)"},"client":{"description":"Client information","allOf":[{"$ref":"#/components/schemas/PublicClientCreateDto"}]},"primary_client":{"description":"Primary client information","allOf":[{"$ref":"#/components/schemas/PublicClientCreateDto"}]},"line_items":{"description":"List of line items to update for the order","type":"array","items":{"$ref":"#/components/schemas/UpdateLineItemDto"}}}},"PublicClientCreateDto":{"type":"object","properties":{"name":{"type":"string","description":"Client name"},"external_client_id":{"type":"string","description":"External client identifier"},"phone":{"type":"object","nullable":true,"description":"Client's phone number"},"email":{"type":"object","nullable":true,"description":"Client's email"},"company":{"type":"object","nullable":true,"description":"Client's company name"}},"required":["name","external_client_id"]},"UpdateLineItemDto":{"type":"object","properties":{"line_item_id":{"type":"string","description":"Line item ID"},"barcode":{"type":"string","description":"Barcode of the item"},"deadline_at":{"format":"date-time","type":"string","description":"Deadline date and time"},"external_user_id":{"type":"string","description":"User id from external(yours) system"},"planned_start_date":{"format":"date-time","type":"string","description":"Planned start date and time"},"external_created_at":{"format":"date-time","type":"string","description":"External created date and time"},"shipping_deadline":{"format":"date-time","type":"string","description":"Shipping deadline date and time"},"quantity":{"type":"number","minimum":0,"description":"Quantity of items"},"line_item_note":{"type":"string","description":"Note or comment for the line item"}},"required":["barcode","quantity"]},"PublicOrderCreateAndUpdateResponseDto":{"type":"object","properties":{"id":{"type":"string","description":"Unique internal identifier of the order"},"external_order_number":{"type":"string","description":"A unique string used in the UI and controlled by the user"},"order_key":{"type":"string","description":"System-generated order key for internal reference"},"external_order_id":{"type":"string","description":"A unique identifier for each order from external system"},"marketplace_order_number":{"type":"object","nullable":true,"description":"A unique string used in the UI and controlled by the user"},"marketplace_note":{"type":"object","nullable":true,"description":"Additional comments or info for the order"},"line_items":{"description":"List of line items associated with the order","type":"array","items":{"$ref":"#/components/schemas/LineItemDto"}}},"required":["id","external_order_number","order_key","external_order_id","marketplace_order_number","marketplace_note","line_items"]},"LineItemDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"line_item_id":{"type":"string","format":"uuid"},"barcode":{"type":"string"},"sku":{"type":"string"},"name":{"type":"string"},"quantity":{"type":"number"},"line_item_note":{"type":"string"},"productions":{"type":"array","items":{"$ref":"#/components/schemas/ProductionWithinLineItemDto"}}},"required":["id","line_item_id","barcode","quantity","productions"]},"ProductionWithinLineItemDto":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"production_key":{"type":"string"},"created_at":{"format":"date-time","type":"string"}},"required":["id","production_key","created_at"]}}},"paths":{"/api/v1/public/orders/{external_order_id}":{"put":{"description":"\nThis method allows to update order properties and separate order lines with new values. Any property not provided will be left unchanged.\n\n**Scenarios for processing the received data**\n\n**📝 Amount updated**\n\n- the quantity is increased (past quantity>new quantity)\n\nThe system counts by how many units the quantity of the product has increased and adds a separate production item to the order for each unit of the difference\n\n- the number is decreased (past quantity<new quantity)\n\nThe system counts by how many units the quantity of the product has decreased and selects difference number with non-started productions among all in the specified order and cancels them\n\nIf decreased difference more than number of non-started productions then system find not finished productions with low production priority and then the smallest progress bar and stops them. \n\n**📝 Quantity is zero**\n\nIf you enter zero in the `quantity` value in the body of the query, the system will cancel all productions in `To Do` status and stop all productions in `In Progress` status of this line item with the specified characteristic. This way, a certain number of created productions with the specified parameters are canceled/stopped within one order.\n\n**📝 Line item is missed in request body**\n\nProductions are not in finished states - the system cancels all productions from this order with specified barcodes. Updates the deadline for the whole order according to the most short term deadline of the item in it.\n\n**📝 Deadline updated**\n\nSystem checks deadlines for each production item with the same barcode in specified order and rewrites them, saving the history and marks that changes were made by external system Updates deadline for the whole order according to the most short term deadline of the item in it.\n","operationId":"PublicOrdersController_update_v1","parameters":[{"name":"external_order_id","required":true,"in":"path","description":"The unique identifier of the order","schema":{"type":"string"}},{"name":"x-tenant-id","in":"header","description":"Tenant id (uuid v4)","required":false,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicOrderUpdateDto"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicOrderCreateAndUpdateResponseDto"}}}},"429":{"description":"Returned when the rate limit is exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum number of allowed requests during the current window","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining number of requests before throttling occurs","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Number of seconds until the rate limit window resets","schema":{"type":"integer"}}}}},"summary":"Update order","tags":["Orders"]}}}}
```

## Cancel external order

> \
> This method allows to cancel all productions in specified order.  \
> \
> \*\*Notes\*\*\
> \
> Productions, additional productions and tasks are not in finished states (not “Done”, “Cancelled”, “From Stock”):\
> \
> \- the system cancels all productions, tasks and additional components from this order with specified barcodes\
> \
> \- updates the deadline for the whole order according to the most short term deadline of the item in it<br>

```json
{"openapi":"3.0.0","info":{"title":"Public API","version":"1.0"},"security":[{"PublicApiKey":[]}],"components":{"securitySchemes":{"PublicApiKey":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"PublicOrderResponseDto":{"type":"object","properties":{"id":{"type":"string","description":"Unique internal identifier of the order"},"external_order_number":{"type":"object","nullable":true,"description":"A unique string used in the UI and controlled by the user"},"marketplace_order_number":{"type":"object","nullable":true,"description":"A unique string used in the UI and controlled by the user"},"external_order_id":{"type":"object","nullable":true,"description":"A unique identifier for each order from external system"},"order_key":{"type":"string","description":"System-generated order key for internal reference"},"comment":{"type":"object","nullable":true,"description":"Additional comments or info for the order"},"to_stock":{"type":"boolean","description":"Indicates if this is an internal company order (e.g., to replenish warehouse stocks)"},"is_deleted":{"type":"boolean","description":"Indicates whether the order has been marked as deleted"},"priority":{"type":"string","description":"Priority level of the order","enum":["Highest","High","Medium","Low","Lowest"]},"client_id":{"type":"object","nullable":true,"description":"Unique identifier of the associated client"},"counterparty_id":{"type":"object","nullable":true,"description":"Unique identifier of the associated counterparty"},"created_at":{"type":"string","description":"Timestamp when the order was created","format":"date-time"}},"required":["id","external_order_number","marketplace_order_number","external_order_id","order_key","comment","to_stock","is_deleted","priority","client_id","counterparty_id","created_at"]}}},"paths":{"/api/v1/public/orders/{id}":{"post":{"description":"\nThis method allows to cancel all productions in specified order.  \n\n**Notes**\n\nProductions, additional productions and tasks are not in finished states (not “Done”, “Cancelled”, “From Stock”):\n\n- the system cancels all productions, tasks and additional components from this order with specified barcodes\n\n- updates the deadline for the whole order according to the most short term deadline of the item in it\n","operationId":"PublicOrdersController_cancel_v1","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"x-tenant-id","in":"header","description":"Tenant id (uuid v4)","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicOrderResponseDto"}}}},"429":{"description":"Returned when the rate limit is exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum number of allowed requests during the current window","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining number of requests before throttling occurs","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Number of seconds until the rate limit window resets","schema":{"type":"integer"}}}}},"summary":"Cancel external order","tags":["Orders"]}}}}
```

## Delete order

> \
> This method allows to delete a single order by its id.\
> \
> \*\*Notes\*\*\
> \
> Productions, additional productions and tasks are not in finished states (not “Done”, “Cancelled”, “From Stock”):\
> \
> \- the system cancels all productions, tasks, additional tasks and additional components from this order with specified barcodes\
> \- Payment for task that are in “In progress” status should be calculated\
> \- Add flag “is deleted” to order info in all canceled productions.\
> \- Updates the deadline for the whole order according to the most short term deadline of the item in it.\
> \- Removes order details assosiated with this order from the list in “New production” and “Change order for production” pop-ups.\
> \
> Productions, additional productions and tasks that are in finished states (not “Done”, “Cancelled”, “From Stock”) remain in the same status.<br>

```json
{"openapi":"3.0.0","info":{"title":"Public API","version":"1.0"},"security":[{"PublicApiKey":[]}],"components":{"securitySchemes":{"PublicApiKey":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"PublicOrderResponseDto":{"type":"object","properties":{"id":{"type":"string","description":"Unique internal identifier of the order"},"external_order_number":{"type":"object","nullable":true,"description":"A unique string used in the UI and controlled by the user"},"marketplace_order_number":{"type":"object","nullable":true,"description":"A unique string used in the UI and controlled by the user"},"external_order_id":{"type":"object","nullable":true,"description":"A unique identifier for each order from external system"},"order_key":{"type":"string","description":"System-generated order key for internal reference"},"comment":{"type":"object","nullable":true,"description":"Additional comments or info for the order"},"to_stock":{"type":"boolean","description":"Indicates if this is an internal company order (e.g., to replenish warehouse stocks)"},"is_deleted":{"type":"boolean","description":"Indicates whether the order has been marked as deleted"},"priority":{"type":"string","description":"Priority level of the order","enum":["Highest","High","Medium","Low","Lowest"]},"client_id":{"type":"object","nullable":true,"description":"Unique identifier of the associated client"},"counterparty_id":{"type":"object","nullable":true,"description":"Unique identifier of the associated counterparty"},"created_at":{"type":"string","description":"Timestamp when the order was created","format":"date-time"}},"required":["id","external_order_number","marketplace_order_number","external_order_id","order_key","comment","to_stock","is_deleted","priority","client_id","counterparty_id","created_at"]}}},"paths":{"/api/v1/public/orders/{id}":{"delete":{"description":"\nThis method allows to delete a single order by its id.\n\n**Notes**\n\nProductions, additional productions and tasks are not in finished states (not “Done”, “Cancelled”, “From Stock”):\n\n- the system cancels all productions, tasks, additional tasks and additional components from this order with specified barcodes\n- Payment for task that are in “In progress” status should be calculated\n- Add flag “is deleted” to order info in all canceled productions.\n- Updates the deadline for the whole order according to the most short term deadline of the item in it.\n- Removes order details assosiated with this order from the list in “New production” and “Change order for production” pop-ups.\n\nProductions, additional productions and tasks that are in finished states (not “Done”, “Cancelled”, “From Stock”) remain in the same status.\n","operationId":"PublicOrdersController_delete_v1","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}},{"name":"x-tenant-id","in":"header","description":"Tenant id (uuid v4)","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicOrderResponseDto"}}}},"429":{"description":"Returned when the rate limit is exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum number of allowed requests during the current window","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining number of requests before throttling occurs","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Number of seconds until the rate limit window resets","schema":{"type":"integer"}}}}},"summary":"Delete order","tags":["Orders"]}}}}
```


---

# Agent Instructions: 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:

```
GET https://docs.hesh.app/manuals/public-api/orders.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
