Create Production Run from Sales Order

Beta
POST/v1/sales/sales-orders/{id}/actions/create-production-run

Idempotent with Idempotency-Key header. Learn more

Creates a production run from a sales order.

Walks the production flow behind each item-backed line to work out what actually has to be made, then creates one batch for each item that is produced directly from raw materials, sized to cover every line that needs it. Reserves the material inventory those batches consume and links the run to the order. The caller becomes the run's responsible user. An order can have at most one production run, and a line whose item has no production flow contributes no batches.

Permission requiredValues:production_runs:create
The role behind your API key or agent must grant this permission.
idstring

Sales order ID.

include[]optional arrayenumValues:responsible_userresponsible_user.user

Sub-objects to expand in the response. When omitted, sub-objects are returned as null.

idstring

Production run ID.

objectstringenumValues:production_run

Resource type identifier.

numberstring

Production run number, unique per account.

Assigned automatically at creation as the next sequential number for the account; can be changed via update.

responsible_useraccount_userExpandablenullable

Account user accountable for executing the run.

Null to customer and supplier portal users, like the run's batches.

idstring

Account user ID.

objectstringenumValues:account_user

Resource type identifier.

statusstringenumValues:activedisabledremoved

The current state of this user's membership in the account.

  • active: the user can sign in to the account and occupies one of the plan's seats.
  • disabled: the user is locked out of the account and their sessions have been revoked, but the membership is retained.
  • removed: the membership has been soft-deleted; it is hidden from listings by default and can be restored with the activate action.
rolerolenullable

The role that determines what this user is permitted to do in the account.

Always returned as null in this endpoint.
departmentdepartmentnullable

The department this user belongs to within the account.

Always returned as null in this endpoint.
useruserExpandablenullable

The underlying user profile, shared across every account this person belongs to.

idstring

User ID.

objectstringenumValues:user

Resource type identifier.

emailstringnullable

Email address the user signs in with and receives platform email at.

namestringnullable

User's full display name.

usernamestringnullable

Username the user can sign in with instead of their email address.

Usernames are unique across the whole platform, not just within your account.

email_verified_atstring (date-time)nullable

When the user verified their email address.

image_urlstringnullable

Location of the user's profile image.

For photos uploaded through the API this holds an internal path rather than a fetchable image URL; call Get User Photo URL to obtain a temporary link to the image itself.

created_atstring (date-time)

Creation timestamp.

updated_atstring (date-time)

Last updated timestamp.

is_commission_eligiblebooleannullable

Whether this user can be assigned as a sales representative on orders, territories, and targets.

Independent of the sales_rep role type, which still scopes analytics and hides cost. Users with the sales_rep role are always eligible.

Null to customer and supplier portal users, like the rest of your commission settings.

notification_typesarray of stringnullableenumValues:invoiceorder_acknowledgementpurchase_order_submission

The notifications you send this user about the customer or supplier account they belong to.

Set when the account you are acting in is a customer or supplier account you manage, and an empty list when none are enabled; turn them on and off with preferences on create and update. null for your own account's users, and where an account user is embedded in another resource.

  • order_acknowledgement: the confirmation email sent when an order is placed for the customer.
  • invoice: invoice emails for the customer's orders.
  • purchase_order_submission: a copy of each purchase order you submit to the supplier.
last_used_atstring (date-time)nullable

When the user last accessed this account.

Null to customer and supplier portal users: it is your own team's activity.

created_atstring (date-time)

When the account user was created.

updated_atstring (date-time)

When the account user was last updated.

batch_countintegernullable

Number of batches currently recorded against this run.

Null to customer and supplier portal users: a run can hold other customers' work.

batch_summarieslistnullable

The run's batches totalled per item and unit, ordered by SKU.

Null to customer and supplier portal users: a run can hold other customers' work.

objectstringenumValues:list

Resource type identifier.

page_infoobject

Pagination metadata.

next_page_urlstringnullable

Relative URL that fetches the next page of results.

previous_page_urlstringnullable

Relative URL that fetches the previous page of results.

has_next_pageboolean

Whether more results exist after this page.

has_prev_pageboolean

Whether results exist before this page.

dataarray of production_run_batch_summary

Resources in this page.

objectstringenumValues:production_run_batch_summary

Resource type identifier.

itementitynullable

The item the batches produce, named by its SKU.

idstring

Unique identifier for the entity.

objectstringenumValues:entity

Resource type identifier.

typestringenumValues:accountactorentity

The resource kind that this entity references, as an object-type value (e.g. user, account).

Unlike object — which is always entity — this names the underlying resource the id points to.

namestringnullable

Human-readable display name for the entity (e.g. a user's full name, a sales order number).

handlestringnullable

Secondary human-readable identifier (e.g. email address, username, redacted API key value).

unitentitynullable

The unit the quantity is counted in, named by its abbreviation.

idstring

Unique identifier for the entity.

objectstringenumValues:entity

Resource type identifier.

typestringenumValues:accountactorentity

The resource kind that this entity references, as an object-type value (e.g. user, account).

Unlike object — which is always entity — this names the underlying resource the id points to.

namestringnullable

Human-readable display name for the entity (e.g. a user's full name, a sales order number).

handlestringnullable

Secondary human-readable identifier (e.g. email address, username, redacted API key value).

quantity_valuestring (decimal)

Total quantity of the batches, as a decimal string.

batch_countinteger

Number of batches in the total.

started_atstring (date-time)nullable

Time the run started production.

Set automatically the first time a batch in the run is scanned at a station.

completed_atstring (date-time)nullable

Time the run finished production.

Set automatically once every batch in the run has been scanned or deleted. From that point the run can no longer be updated and no further batches can be added to it.

created_atstring (date-time)

Creation timestamp.

updated_atstring (date-time)

Last-updated timestamp.

Responses

201

Successful response for Create Production Run from Sales Order