{"openapi":"3.1.0","info":{"title":"Zela Print printer API","version":"1.1.0","description":"Send print orders to Zela Print. Human-readable guide: https://zelaprint.com/developers"},"servers":[{"url":"https://zelaprint.com/api/v1"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"zp_live_… or zp_test_…"}},"responses":{"Error":{"description":"An error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}}}}}}}}},"schemas":{"Recipient":{"type":"object","required":["name","address1","city","postcode","country"],"properties":{"name":{"type":"string","maxLength":120},"company":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"address1":{"type":"string"},"address2":{"type":["string","null"]},"city":{"type":"string"},"region":{"type":["string","null"]},"postcode":{"type":"string","description":"\"N/A\" for a country with no postcodes"},"country":{"type":"string","pattern":"^[A-Z]{2}$","description":"ISO 3166-1 alpha-2"}}},"OrderItemInput":{"type":"object","required":["size"],"properties":{"size":{"type":"string","description":"A size from GET /products"},"quantity":{"type":"integer","minimum":1,"maximum":100,"default":1},"artwork_url":{"type":"string","format":"uri","description":"Give this or file_id"},"file_id":{"type":"string","description":"From POST /files. Give this or artwork_url"},"paper":{"type":"string","description":"A paper key from GET /products. Left out = the default paper"},"frame":{"type":"string","description":"A frame key from GET /products. Left out = rolled print"},"external_id":{"type":"string","maxLength":100,"description":"Your own reference for this line"}}},"OrderInput":{"type":"object","required":["external_id","recipient","items"],"properties":{"external_id":{"type":"string","maxLength":100,"description":"Your reference, unique among your orders that are not cancelled or failed"},"recipient":{"$ref":"#/components/schemas/Recipient"},"items":{"type":"array","minItems":1,"maxItems":50,"items":{"$ref":"#/components/schemas/OrderItemInput"}},"notes":{"type":"string","maxLength":1000},"confirm":{"type":"boolean","default":true,"description":"false = a draft: priced and checked, nothing paid or printed until POST /orders/{id}/confirm"},"insert":{"type":"object","properties":{"artwork_url":{"type":"string","format":"uri","description":"Give this or file_id"},"file_id":{"type":"string","description":"From POST /files"}},"description":"A 4x6 inch card printed and put in the parcel"},"shipping":{"oneOf":[{"enum":["standard","own_label"]},{"type":"object","properties":{"method":{"enum":["standard","own_label"]},"label_url":{"type":"string","format":"uri"},"label_file_id":{"type":"string"}},"description":"own_label needs label_url or label_file_id (4x6 PDF)"}]}}},"OrderPatch":{"type":"object","description":"Only before the order is accepted. Send only what changes.","properties":{"recipient":{"type":"object","description":"Recipient fields to change"},"notes":{"type":["string","null"]},"items":{"type":"array","items":{"type":"object","required":["index"],"properties":{"index":{"type":"integer"},"artwork_url":{"type":"string","format":"uri","description":"Give this or file_id"},"file_id":{"type":"string","description":"From POST /files"}}}},"insert":{"type":"object","properties":{"artwork_url":{"type":"string","format":"uri","description":"Give this or file_id"},"file_id":{"type":"string","description":"From POST /files"}}},"shipping":{"type":"object","properties":{"label_url":{"type":"string"},"label_file_id":{"type":"string"}}}}},"Order":{"type":"object","properties":{"id":{"type":"string"},"external_id":{"type":"string"},"mode":{"enum":["live","test"]},"status":{"enum":["draft","processing","on_hold","accepted","printing","shipped","cancelled","failed"]},"hold_reason":{"type":["string","null"]},"failure_reason":{"type":["string","null"]},"recipient":{"$ref":"#/components/schemas/Recipient"},"items":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer"},"external_id":{"type":["string","null"]},"paper":{"type":["string","null"]},"frame":{"type":["string","null"]},"size":{"type":"string"},"quantity":{"type":"integer"},"artwork_url":{"type":["string","null"]},"file_id":{"type":["string","null"]},"unit_price_pence":{"type":"integer","description":"Pence (GBP)"},"total_price_pence":{"type":"integer","description":"Pence (GBP)"},"artwork":{"type":"object","properties":{"status":{"enum":["pending","processing","ready","failed"]},"error":{"type":["string","null"]}}}}}},"insert":{"type":["object","null"],"properties":{"artwork_url":{"type":["string","null"]},"file_id":{"type":["string","null"]},"status":{"enum":["pending","processing","ready","failed"]},"error":{"type":["string","null"]}}},"shipping":{"type":"object","properties":{"method":{"enum":["standard","own_label"]},"label":{"type":["object","null"],"properties":{"artwork_url":{"type":["string","null"]},"file_id":{"type":["string","null"]},"status":{"enum":["pending","processing","ready","failed"]},"error":{"type":["string","null"]}}}}},"notes":{"type":["string","null"]},"costs":{"type":"object","properties":{"currency":{"const":"GBP"},"items_pence":{"type":"integer","description":"Pence (GBP)"},"shipping_pence":{"type":"integer","description":"Pence (GBP)"},"insert_pence":{"type":"integer","description":"Pence (GBP)"},"total_pence":{"type":"integer","description":"Pence (GBP)"},"vat_included_pence":{"type":"integer","description":"Pence (GBP)"},"refunded_pence":{"type":"integer","description":"Pence (GBP)"}}},"billing":{"enum":["balance","account"]},"tracking":{"type":["object","null"],"properties":{"carrier":{"type":["string","null"]},"number":{"type":["string","null"]},"url":{"type":["string","null"]}}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"accepted_at":{"type":["string","null"]},"shipped_at":{"type":["string","null"]},"cancelled_at":{"type":["string","null"]}}},"OrderEnvelope":{"type":"object","properties":{"order":{"$ref":"#/components/schemas/Order"}}}}},"paths":{"/account":{"get":{"summary":"Your account, billing and balance","responses":{"200":{"description":"OK"},"401":{"$ref":"#/components/responses/Error"}}}},"/products":{"get":{"summary":"Sizes with your price, papers, frames, extras, shipping methods and shipping per country","parameters":[{"name":"country","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"$ref":"#/components/responses/Error"}}}},"/quotes":{"post":{"summary":"Price an order without saving it","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["country","items"],"properties":{"country":{"type":"string"},"postcode":{"type":"string"},"shipping":{"enum":["standard","own_label"]},"insert":{"type":"boolean"},"items":{"type":"array","items":{"type":"object","properties":{"size":{"type":"string"},"quantity":{"type":"integer"},"paper":{"type":"string"},"frame":{"type":"string"}}}}}}}}},"responses":{"200":{"description":"The price"},"400":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}}}},"/files":{"post":{"summary":"Start an upload; PUT the bytes to upload_url within an hour","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["filename","content_type","size_bytes"],"properties":{"filename":{"type":"string"},"content_type":{"enum":["image/jpeg","image/png","image/tiff","image/webp","image/heic","application/pdf"]},"size_bytes":{"type":"integer","maximum":157286400}}}}}},"responses":{"201":{"description":"file, upload_url, upload_headers, expires_at"},"400":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"}}}},"/files/{id}":{"get":{"summary":"Whether a file has arrived","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"404":{"$ref":"#/components/responses/Error"}}}},"/orders":{"post":{"summary":"Send an order","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","maxLength":100}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderInput"}}}},"responses":{"200":{"description":"Same Idempotency-Key as an earlier order: that order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderEnvelope"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderEnvelope"}}}},"400":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}}},"get":{"summary":"Your orders, newest first","parameters":[{"name":"status","in":"query","schema":{"type":"string"}},{"name":"external_id","in":"query","schema":{"type":"string"}},{"name":"created_after","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer"}},{"name":"before","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"orders, has_more, next_before"}}}},"/orders/{id}":{"get":{"summary":"One order","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderEnvelope"}}}},"404":{"$ref":"#/components/responses/Error"}}},"patch":{"summary":"Change the address, notes or files before the order is accepted","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderPatch"}}}},"responses":{"200":{"description":"Changed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderEnvelope"}}}},"400":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"}}}},"/orders/{id}/confirm":{"post":{"summary":"A draft goes ahead","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Confirmed"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"}}}},"/orders/{id}/cancel":{"post":{"summary":"Cancel before it is accepted","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Cancelled"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"}}}},"/orders/{id}/simulate":{"post":{"summary":"Test keys only: move a test order on","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"enum":["printing","shipped","tracking_updated","cancelled"]}}}}}},"responses":{"200":{"description":"OK"},"403":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"}}}},"/webhooks/test":{"post":{"summary":"Send a signed test event to your webhook now","responses":{"200":{"description":"delivered, status, error"},"400":{"$ref":"#/components/responses/Error"}}}}},"webhooks":{"orderEvent":{"post":{"summary":"order.created | order.updated | order.accepted | order.on_hold | order.failed | order.printing | order.shipped | order.tracking_updated | order.refunded | order.cancelled","description":"Header Zela-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"enum":["order.created","order.updated","order.accepted","order.on_hold","order.failed","order.printing","order.shipped","order.tracking_updated","order.refunded","order.cancelled"]},"created_at":{"type":"string"},"data":{"$ref":"#/components/schemas/Order"}}}}}},"responses":{"200":{"description":"Any 2xx within 10 seconds"}}}}}}