Copy a job
AI agents: read /llms.txt; add .md to any page URL. This page as Markdown: /reference/jobs/v2-job-clone.md. Index of every page and the rules for every call: /llms.txt. Guides and concepts in one file: /llms-full.txt. OpenAPI: /openapi.json.
PUT/
Copies a job into a sales order or quote: the same one or another of your team's. Returns the new job.
By default the copy takes the job's line items, tasks, mockups and files, but not its approvals. Dates keep their distance from the order's issue date: the copy starts and is due as long after the target order's issue date as the original is after its own order's (so within the same order they don't change). A job without both dates uses its tasks' earliest start and latest due date; with neither, the copy is unscheduled.
Lines on phased-out or deleted products, sizes or colors are never copied as they are. If the job has any, the first call is refused with clone_needs_choices, which lists them. Call again with an item_choices entry for each: leave it out, or replace it with another size or color of the same product that is still sold.
Business rules
- A choice for a line that is on sale is refused with
clone_choice_not_needed; a choice naming a line that isn't on the job withclone_choice_unknown_line. - A product without sizes or colors can only be left out:
replaceon it isclone_replacement_invalid. - A replacement must be another variant of the same product that is still sold (
clone_replacement_invalid). - Nothing is copied when a choice is refused.
Side effects
- Creates the job, and copies of its lines, tasks and files as chosen.
- Recalculates the target order and may run its auto-invoicing; neither happens when the target order came from Shopify.
- Open Admin Portal pages refresh after the copy is saved.
Path parameters
Your team slug, shown as Team ID next to your API key in Profile.
- Example
your-team
- Example
The job's hash id (
id). Hash ids only: a unique key or a document number gives 404.- Example
WaGvtaWsx7Kcn4
- Example
Request body
application/json, required.
The sales order or quote to copy into (hash id or unique key). It can be the job's own order.
clone_job_approvalbooleanCopy the job's approvals. Fails with 500 when an approval includes mockup designs, or includes files while
clone_mediais false.- Default
false
- Default
clone_mediabooleanCopy the mockups and production files.
- Default
true
- Default
clone_mockup_designsbooleanCopy mockup designs. Defaults to
clone_media.clone_order_itembooleanCopy the line items. Ignored (never copied) when either order came from Shopify.
- Default
true
- Default
clone_work_pipelinebooleanCopy the tasks.
- Default
true
- Default
item_choicesarray of objectsOne choice per line that uses a phased-out or deleted product, size or color. Only for those lines.
Fields of each item (3)
- One of:
"leave_out","replace"
- One of:
The line item on the source job. Each line at most once.
replacement_idstringRequired for
replace: another size or color (variant) of the same product that is still on sale.
More examples (1)
Copy with choices for unsellable lines
curl -X PUT 'https://secure.yoprint.com/v2/api/store/your-team/v2/job/WaGvtaWsx7Kcn4/clone' \ -H 'Authorization: Bearer YOUR_API_KEY' \ -H 'Accept: application/json' \ -H 'X-Yoprint-Decimal-Format: exact-v1' \ -H 'Content-Type: application/json' \ -d '{ "clone_job_approval": false, "item_choices": [ { "action": "leave_out", "id": "ZJTJ2uF5dMiArL" }, { "action": "replace", "id": "Py196Qo19s55qk", "replacement_id": "Tl6eTHKHoKqrMw" } ], "target_order": "yYkdcUrFwnbqE2" }'Response
200Successful response.
A job.
Child fields (43)
assigned_usersarray of objectsPeople on the job.
Fields of each item (3)
avatar_urlstring | nullidstringThe user.
namestring
auto_saved_forstring | nullSet only on autosave copies.
customerobjectdue_datestring (date-time) | nullProduction due date. ISO 8601 with offset, or null.
from_legacybooleanhas_servicebooleanKept for older clients; not a count of services.
idstringThe job.
impression_countnumber | nullinventory_statusstring | nullThe stock status of the job's lines.
is_rushbooleanitem_countnumber | nullUnits on the job.
location_countnumber | nullmockuparray of objectsMockup files.
mockup_design_countintegermockup_summaryobjectChild fields (2)
countintegerhas_mockupsboolean
namestring | nullneed_cust_provide_productboolean | integer | nullBlanks are provided by the customer.
notestring | nullorder_customer_po_numberstring | nullorder_idstringThe order.
order_scoped_idstringThe order number.
pdfarray of objectsPDF links.
The open approval request, if any.
pipelinesarray of objectsThe job's tasks.
Fields of each item (24)
assigned_usersarray of objectsWho is assigned.
- Same fields as
data.assigned_users.
- Same fields as
created_atstring (date-time)due_datestring (date-time) | nullTask due date. ISO 8601 with offset, or null.
idstringThe task.
job_idstringThe job.
job_is_rushboolean | integer | nulljob_item_countnumber | nulljob_namestring | nulljob_scoped_idstringThe job number with its prefix.
job_status_idstring | nullThe job's current status.
namestringnotestring | nullorder_idstringThe order.
order_namestring | nullorder_scoped_idstring | nullThe order number.
pipeline_idstringThe task preset it comes from.
positionintegerOrder among tasks; lower comes first. 0 when unset.
sales_orderobjectA summary of the job's order.
Child fields (14)
created_bystring | nullWho created the order.
cust_due_datestring (date-time) | nullOrder customer due (in-hand) date. ISO 8601 with offset, or null.
customer_idstring | nullThe customer.
customer_namestring | nulldue_datestring (date-time) | nullOrder production due date. ISO 8601 with offset, or null.
external_typestring | nullshopifywhen the order came from Shopify, else null.is_quotebooleanissue_datestring (date-time) | nullOrder issue date. ISO 8601 with offset, or null.
object_typestring | nullsales_orderorquote.ship_due_datestring (date-time) | nullOrder ship-by date. ISO 8601 with offset, or null.
shopify_deleted_externallybooleanshopify_deleted_externally_atstring (date-time) | nullWhen it was deleted in Shopify. ISO 8601 with offset, or null.
start_datestring (date-time) | nullOrder production start. ISO 8601 with offset, or null.
status_idstring | nullThe order status.
start_datestring (date-time) | nullTask start. ISO 8601 with offset, or null.
statusobjectA status: label, kind and place in the list.
Child fields (9)
colorstring | nullHex color.
customer_labelstringidstringThe status.
labelstringpipeline_idstringOnly on the statuses of a task preset (
rolepipeline): the task preset. Absent on other statuses.positionintegerIts place in the team's list: sort by it to find the next status.
rolestringWhich list it belongs to:
jobfor job statuses,pipelinefor the statuses of a task preset.- One of:
"order","quote","job","purchase_order","shipment","customer_message","pipeline"
- One of:
trashedbooleanThe status was deleted.
typestringThe kind of status:
start(Pending),pre_productionandin_progress(In Progress),end(Completed).- One of:
"start","pre_production","in_progress","end"
- One of:
status_completion_datestring (date-time) | nullWhen it reached a Completed status. ISO 8601 with offset, or null.
status_idstringThe task's status (a status of its task preset).
status_last_change_datestring (date-time) | nullWhen the status last changed. ISO 8601 with offset, or null.
updated_atstring (date-time)
positioninteger | nullpricing_original_totaldecimal pairThe job's price before pricing rules, at the stored scale. A decimal pair: the amount is
value÷ 10^dp({ "value": 1250, "dp": 2 }is 12.50). Readdpevery time: it can differ between fields and records.- See Money and quantities.
pricing_rule_appliedobject | nullThe pricing rule that set the job's decoration price, or null. These answers usually carry only
type, the two ids and the two totals. List the jobs of a sales order or quote and Get one job of a sales order or quote answer with the full summary (the rule's current name and position, the prices before and after).Child fields (12)
afterstring | nullFull summary only: the price after the rule, as a decimal string.
after_totaldecimal pairThe decoration price after the rule. A decimal pair: the amount is
value÷ 10^dp({ "value": 1250, "dp": 2 }is 12.50). Readdpevery time: it can differ between fields and records.- See Money and quantities.
basestring | nullFull summary only: the decoration price the rule started from, as a decimal string.
base_typestring | nullFull summary only:
service_price.normal_pricestring | nullFull summary only: the price with no rule (the same as
basefor a job).original_totaldecimal pairThe decoration price before the rule. A decimal pair: the amount is
value÷ 10^dp({ "value": 1250, "dp": 2 }is 12.50). Readdpevery time: it can differ between fields and records.- See Money and quantities.
pricing_group_idstring | nullThe pricing group.
pricing_group_namestring | nullFull summary only: the group's name now.
pricing_group_removedboolean | nullFull summary only: true when the group was removed since. The job keeps its price.
pricing_rule_idstring | nullThe pricing rule.
ruleobject | nullFull summary only: the rule as the group holds it now (
id,label,position, where 1 is the first rule checked), or null when it no longer exists.typestring | nullserviceon a job.
pricing_totaldecimal pairThe job's price, at the stored scale (usually 6 decimal places:
{ "value": 600000000, "dp": 6 }is 600.00). A decimal pair: the amount isvalue÷ 10^dp({ "value": 1250, "dp": 2 }is 12.50). Readdpevery time: it can differ between fields and records.- See Money and quantities.
production_filearray of objectsProduction files.
- Same fields as
data.mockup.
- Same fields as
qr_code_urlstring | nullA QR code image for the job.
sales_orderobjectA summary of the job's order.
Child fields (14)
created_bystring | nullWho created the order.
cust_due_datestring (date-time) | nullOrder customer due (in-hand) date. ISO 8601 with offset, or null.
due_datestring (date-time) | nullOrder production due date. ISO 8601 with offset, or null.
external_typestring | nullshopifywhen the order came from Shopify, else null.is_quotebooleanis_rushbooleanissue_datestring (date-time) | nullOrder issue date. ISO 8601 with offset, or null.
namestring | nullOrder name.
object_typestring | nullsales_orderorquote.ship_due_datestring (date-time) | nullOrder ship-by date. ISO 8601 with offset, or null.
shopify_deleted_externallybooleanshopify_deleted_externally_atstring (date-time) | nullWhen it was deleted in Shopify. ISO 8601 with offset, or null.
start_datestring (date-time) | nullOrder production start. ISO 8601 with offset, or null.
status_idstring | nullThe order status.
scoped_idstringThe job number as shown, with its
JOB-prefix. Change a job number takes only the digits.servicesarray of objectsThe services (decorations).
Fields of each item (9)
customer_notestring | nullCustomer notes.
idstringThe job service.
locationobjectnotestring | nullInternal notes.
optionanyThe service option.
positioninteger | nullA decimal pair, or null.
service_idstringThe service.
service_namestring
services_still_validbooleanstart_datestring (date-time) | nullProduction start. ISO 8601 with offset, or null.
statusobjectA status: label, kind and place in the list.
- Same fields as
data.pipelines[].status.
- Same fields as
status_completion_datestring (date-time) | nullWhen it reached a Completed status. ISO 8601 with offset, or null.
status_idstringThe job's current status: its production stage. Look it up in List job statuses, or read
status.status_last_change_datestring (date-time) | nullWhen the status last changed. ISO 8601 with offset, or null.
total_qty_need_orderingstring | nullQuantity that still needs ordering, with 8 decimal places (
"12.00000000"). A decimal string, such as"0.00000000"; parse it as a decimal.unique_keystring | nullThe job's unique key.
versioninteger
Errors
401The API key is missing or wrong (
unauthenticated).403You are not allowed to do this.
api_access_not_in_plan: your team's plan doesn't include API access (Pro and above, with an active subscription or trial), so every request answers this until the team upgrades. When your role lacks the permission the operation needs, the body is only{"message": "Insufficient Permission"}. Other refusals use the error envelope, withunauthorizedoruser_is_not_authorized.- When
- You can't view the source order or edit the target order.
- Fix
- Ask the team owner to adjust your role or assign you to the orders.
404Not found.
page_not_found: the team slug is unknown, you are not a member of the team, or an id in the path is not one of this team's.code: null, with a message that starts "No query results for": there is no record with that id.- When
- The job or
target_orderisn't your team's. - Fix
- Check both ids.
422The request was refused and changed nothing.
validation_failedlists what to fix inerror.fields; other codes name a business rule, explained inerror.message. A few checks answer with only{"message": "..."}. An operation that calls another service (a payment provider, a carrier, an accounting app) can answerconnect_timeout("Please retry again") when that service does not answer in time: the change may or may not have happened there, so read the record back before you retry.- When
- Lines need choices:
clone_needs_choices, with the lines inerror.linesand their jobs inerror.jobs(directly undererror, not inerror.data). Each line hasid,job_id,product_id,product_name,product_type,quantity(a decimal string),reason(variant_phased_out,variant_deleted,product_phased_outorproduct_deleted) and, for variant products,product_size,product_color,size_idandcolor_id. Each job hasid,scoped_id(JOB-126),nameandkeeps_products. - Fix
- Send one
item_choicesentry for each listed line, then call again. - When
- A choice is refused:
clone_choice_not_needed(sameerror.linesanderror.jobs, listing the lines that are on sale again),clone_choice_unknown_line(the unknown line ids inerror.ids) orclone_replacement_invalid(the line inerror.line). - Fix
- Correct
item_choicesas the rules say, then call again.
500A business rule refused the request (see the operation's errors), or something failed inside YoPrint. Refusals use the error envelope with a code such as
action_not_allowed; an unexpected failure answers{"message": "Server Error"}. Repeating a refusal gets the same answer; after an unexpected failure, read the record back before you retry a change.- When
- With
clone_job_approval: an approval includes mockup designs, or it includes files andclone_mediais false. The body is{ "message": "Server Error" }and nothing is copied. - Fix
- Copy without approvals, or keep
clone_mediaon.
Related
- GETGet one job of an order
/v2/ api/ store/ {team_slug}/ v2/ sales_order/ {hash_id}/ job/ {job_id} - PUTUpdate a job
/v2/ api/ store/ {team_slug}/ v2/ job/ {hash_id} - DELETEDelete a job
/v2/ api/ store/ {team_slug}/ v2/ job/ {hash_id}
