{"openapi":"3.1.0","info":{"title":"Slatestock API","version":"1","description":"Every record in a workspace, as JSON. 600 requests a minute per workspace, no daily cap; over the limit the answer is 429 with Retry-After."},"servers":[{"url":"https://slatestock.com/api/v1"}],"security":[{"apiKey":[]}],"tags":[{"name":"Products and variants"},{"name":"Locations"},{"name":"Stock levels"},{"name":"Stock movements"},{"name":"Suppliers"},{"name":"Purchase orders"},{"name":"Customers"},{"name":"Price lists"},{"name":"Sales orders"},{"name":"Invoices"},{"name":"Returns and credit notes"},{"name":"Business details"},{"name":"Audit trail"},{"name":"Integration activity log"},{"name":"Reports"},{"name":"Webhook endpoints"}],"paths":{"/products":{"get":{"operationId":"get_products","summary":"List products.","tags":["Products and variants"],"parameters":[{"name":"limit","in":"query","required":false,"description":"Records per page, 1 to 250; 50 by default.","schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"description":"The next_cursor from the page before.","schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"description":"Only records changed at or after this date and time.","schema":{"type":"string"}}],"responses":{"200":{"description":"List products.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"has_more":{"type":"boolean"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","has_more","next_cursor"],"additionalProperties":false}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"post_products","summary":"Create a product.","tags":["Products and variants"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"201":{"description":"Create a product.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"category":{"type":"string"},"brand":{"type":"string"},"option_names":{"type":"array","items":{"type":"string"}},"archived":{"type":"boolean"}},"required":["code","name"],"additionalProperties":false}}}}}},"/products/{id}":{"get":{"operationId":"get_products_by_id","summary":"Get one product.","tags":["Products and variants"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Get one product.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"patch_products_by_id","summary":"Update a product.","tags":["Products and variants"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"Update a product.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"category":{"type":"string"},"brand":{"type":"string"},"option_names":{"type":"array","items":{"type":"string"}},"archived":{"type":"boolean"}},"required":[],"additionalProperties":false}}}}}},"/products/{id}/variants":{"get":{"operationId":"get_products_by_id_variants","summary":"List a product's variants.","tags":["Products and variants"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Records per page, 1 to 250; 50 by default.","schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"description":"The next_cursor from the page before.","schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"description":"Only records changed at or after this date and time.","schema":{"type":"string"}}],"responses":{"200":{"description":"List a product's variants.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Variant"}},"has_more":{"type":"boolean"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","has_more","next_cursor"],"additionalProperties":false}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"post_products_by_id_variants","summary":"Add a variant.","tags":["Products and variants"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"201":{"description":"Add a variant.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Variant"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"sku":{"type":"string"},"name":{"type":"string"},"barcode":{"type":"string"},"option_values":{"type":"array","items":{"type":"string"}},"unit":{"type":"string"},"unit_cost":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"list_price":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"reorder_point":{"type":"integer"},"reorder_quantity":{"type":"integer"},"supplier_id":{"type":"string"},"supplier_sku":{"type":"string"},"supplier_cost":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"archived":{"type":"boolean"}},"required":["sku","name"],"additionalProperties":false}}}}}},"/variants":{"get":{"operationId":"get_variants","summary":"List variants; filter by sku or barcode.","tags":["Products and variants"],"parameters":[{"name":"limit","in":"query","required":false,"description":"Records per page, 1 to 250; 50 by default.","schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"description":"The next_cursor from the page before.","schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"description":"Only records changed at or after this date and time.","schema":{"type":"string"}},{"name":"sku","in":"query","required":false,"description":"Only the variant with this SKU.","schema":{"type":"string"}},{"name":"barcode","in":"query","required":false,"description":"Only the variant with this barcode.","schema":{"type":"string"}}],"responses":{"200":{"description":"List variants; filter by sku or barcode.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Variant"}},"has_more":{"type":"boolean"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","has_more","next_cursor"],"additionalProperties":false}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/variants/{id}":{"get":{"operationId":"get_variants_by_id","summary":"Get one variant.","tags":["Products and variants"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Get one variant.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Variant"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"patch_variants_by_id","summary":"Update a variant.","tags":["Products and variants"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"Update a variant.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Variant"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"sku":{"type":"string"},"name":{"type":"string"},"barcode":{"type":"string"},"option_values":{"type":"array","items":{"type":"string"}},"unit":{"type":"string"},"unit_cost":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"list_price":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"reorder_point":{"type":"integer"},"reorder_quantity":{"type":"integer"},"supplier_id":{"type":"string"},"supplier_sku":{"type":"string"},"supplier_cost":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"archived":{"type":"boolean"}},"required":[],"additionalProperties":false}}}}}},"/locations":{"get":{"operationId":"get_locations","summary":"List locations.","tags":["Locations"],"parameters":[{"name":"limit","in":"query","required":false,"description":"Records per page, 1 to 250; 50 by default.","schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"description":"The next_cursor from the page before.","schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"description":"Only records changed at or after this date and time.","schema":{"type":"string"}}],"responses":{"200":{"description":"List locations.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Location"}},"has_more":{"type":"boolean"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","has_more","next_cursor"],"additionalProperties":false}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"post_locations","summary":"Create a location.","tags":["Locations"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"201":{"description":"Create a location.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Location"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"kind":{"type":"string","enum":["warehouse","store","shop","3pl"]},"archived":{"type":"boolean"},"for_trade":{"type":"boolean"}},"required":["code","name","kind"],"additionalProperties":false}}}}}},"/locations/{id}":{"get":{"operationId":"get_locations_by_id","summary":"Get one location.","tags":["Locations"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Get one location.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Location"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"patch_locations_by_id","summary":"Update a location.","tags":["Locations"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"Update a location.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Location"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"kind":{"type":"string","enum":["warehouse","store","shop","3pl"]},"archived":{"type":"boolean"},"for_trade":{"type":"boolean"}},"required":[],"additionalProperties":false}}}}}},"/stock_levels":{"get":{"operationId":"get_stock_levels","summary":"List stock on hand by variant and location; filter by sku, variant_id or location_id.","tags":["Stock levels"],"parameters":[{"name":"limit","in":"query","required":false,"description":"Records per page, 1 to 250; 50 by default.","schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"description":"The next_cursor from the page before.","schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"description":"Only records changed at or after this date and time.","schema":{"type":"string"}},{"name":"location_id","in":"query","required":false,"description":"Only this location.","schema":{"type":"string"}},{"name":"variant_id","in":"query","required":false,"description":"Only this variant. Repeat it for several, up to 250.","schema":{"type":"array","items":{"type":"string"}},"style":"form","explode":true},{"name":"sku","in":"query","required":false,"description":"Only the variant with this SKU. Repeat it for several (sku=A&sku=B), up to 250.","schema":{"type":"array","items":{"type":"string"}},"style":"form","explode":true}],"responses":{"200":{"description":"List stock on hand by variant and location; filter by sku, variant_id or location_id.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/StockLevel"}},"has_more":{"type":"boolean"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","has_more","next_cursor"],"additionalProperties":false}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/stock_levels/{variant_id}":{"get":{"operationId":"get_stock_levels_by_variant_id","summary":"Get one variant at every location. below_reorder_point compares available plus on order with the reorder point.","tags":["Stock levels"],"parameters":[{"name":"variant_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Get one variant at every location. below_reorder_point compares available plus on order with the reorder point.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockLevelDetail"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/stock_movements":{"get":{"operationId":"get_stock_movements","summary":"List movements, newest first.","tags":["Stock movements"],"parameters":[{"name":"limit","in":"query","required":false,"description":"Records per page, 1 to 250; 50 by default.","schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"description":"The next_cursor from the page before.","schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"description":"Only records changed at or after this date and time.","schema":{"type":"string"}},{"name":"variant_id","in":"query","required":false,"description":"Only this variant.","schema":{"type":"string"}},{"name":"location_id","in":"query","required":false,"description":"Only this location.","schema":{"type":"string"}},{"name":"kind","in":"query","required":false,"description":"One or more of opening, receipt, shipment, adjustment, transfer, return.","schema":{"type":"string"}},{"name":"source","in":"query","required":false,"description":"One or more of screen, scan, api, import, sync.","schema":{"type":"string"}}],"responses":{"200":{"description":"List movements, newest first.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/StockMovement"}},"has_more":{"type":"boolean"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","has_more","next_cursor"],"additionalProperties":false}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/stock_adjustments":{"post":{"operationId":"post_stock_adjustments","summary":"Adjust stock, up to 250 lines, each with a reason.","tags":["Stock movements"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"201":{"description":"Adjust stock, up to 250 lines, each with a reason.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/StockMovement"}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"note":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"variant_id":{"type":"string"},"sku":{"type":"string"},"location_id":{"type":"string"},"quantity":{"type":"integer"},"reason":{"type":"string","enum":["count","damage","found","correction","other"]},"note":{"type":"string"}},"required":["location_id","quantity","reason"],"additionalProperties":false}}},"required":["lines"],"additionalProperties":false}}}}}},"/transfers":{"post":{"operationId":"post_transfers","summary":"Move stock between two locations. Moving reserved units needs allow_reserved: true, else 422.","tags":["Stock movements"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"201":{"description":"Move stock between two locations. Moving reserved units needs allow_reserved: true, else 422.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Transfer"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"variant_id":{"type":"string"},"sku":{"type":"string"},"from_location_id":{"type":"string"},"to_location_id":{"type":"string"},"quantity":{"type":"integer"},"note":{"type":"string"},"allow_reserved":{"type":"boolean","description":"Set true to move units that open sales orders have reserved at the source. Without it, such a transfer is refused with a 422."}},"required":["from_location_id","to_location_id","quantity"],"additionalProperties":false}}}}}},"/stock_counts":{"post":{"operationId":"post_stock_counts","summary":"Set stock at a location to what was counted. Each difference posts as an adjustment with the reason count.","tags":["Stock movements"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"201":{"description":"Set stock at a location to what was counted. Each difference posts as an adjustment with the reason count.","content":{"application/json":{"schema":{"type":"object","properties":{"location_id":{"type":"string"},"adjusted":{"type":"array","items":{"type":"object","properties":{"variant_id":{"type":"string"},"sku":{"type":"string"},"on_hand_before":{"type":"integer"},"counted":{"type":"integer"},"variance":{"type":"integer"}},"required":["variant_id","sku","on_hand_before","counted","variance"],"additionalProperties":false}},"movements":{"type":"array","items":{"$ref":"#/components/schemas/StockMovement"}}},"required":["location_id","adjusted","movements"],"additionalProperties":false}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"location_id":{"type":"string","description":"The location counted."},"note":{"type":"string","description":"A note on every adjustment the count posts."},"lines":{"type":"array","items":{"type":"object","properties":{"variant_id":{"type":"string"},"sku":{"type":"string"},"counted":{"type":"integer","description":"Units counted on the shelf, 0 or more. On hand at the location is set to this."}},"required":["counted"],"additionalProperties":false}}},"required":["location_id","lines"],"additionalProperties":false}}}}}},"/suppliers":{"get":{"operationId":"get_suppliers","summary":"List suppliers.","tags":["Suppliers"],"parameters":[{"name":"limit","in":"query","required":false,"description":"Records per page, 1 to 250; 50 by default.","schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"description":"The next_cursor from the page before.","schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"description":"Only records changed at or after this date and time.","schema":{"type":"string"}}],"responses":{"200":{"description":"List suppliers.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Supplier"}},"has_more":{"type":"boolean"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","has_more","next_cursor"],"additionalProperties":false}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"post_suppliers","summary":"Create a supplier.","tags":["Suppliers"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"201":{"description":"Create a supplier.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Supplier"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"contact_name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"currency":{"type":"string","enum":["USD","CAD","GBP","EUR"]},"payment_terms_days":{"type":"integer"},"lead_time_days":{"type":"integer"},"tax_number":{"type":"string"}},"required":["code","name","currency"],"additionalProperties":false}}}}}},"/suppliers/{id}":{"get":{"operationId":"get_suppliers_by_id","summary":"Get one supplier.","tags":["Suppliers"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Get one supplier.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Supplier"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"patch_suppliers_by_id","summary":"Update a supplier.","tags":["Suppliers"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"Update a supplier.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Supplier"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"contact_name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"currency":{"type":"string","enum":["USD","CAD","GBP","EUR"]},"payment_terms_days":{"type":"integer"},"lead_time_days":{"type":"integer"},"tax_number":{"type":"string"}},"required":[],"additionalProperties":false}}}}}},"/purchase_orders":{"get":{"operationId":"get_purchase_orders","summary":"List purchase orders.","tags":["Purchase orders"],"parameters":[{"name":"limit","in":"query","required":false,"description":"Records per page, 1 to 250; 50 by default.","schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"description":"The next_cursor from the page before.","schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"description":"Only records changed at or after this date and time.","schema":{"type":"string"}},{"name":"status","in":"query","required":false,"description":"One or more of draft, sent, partly_received, received, closed.","schema":{"type":"string"}},{"name":"supplier_id","in":"query","required":false,"description":"Only this supplier's orders.","schema":{"type":"string"}}],"responses":{"200":{"description":"List purchase orders.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrder"}},"has_more":{"type":"boolean"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","has_more","next_cursor"],"additionalProperties":false}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"post_purchase_orders","summary":"Create a purchase order.","tags":["Purchase orders"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"201":{"description":"Create a purchase order.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseOrder"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"supplier_id":{"type":"string"},"location_id":{"type":"string"},"status":{"type":"string","enum":["draft","sent"]},"expected_date":{"type":"string"},"supplier_reference":{"type":"string"},"notes":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"variant_id":{"type":"string"},"sku":{"type":"string"},"quantity":{"type":"integer"},"unit_cost":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."}},"required":["quantity"],"additionalProperties":false}}},"required":["supplier_id","location_id","lines"],"additionalProperties":false}}}}}},"/purchase_orders/{id}":{"get":{"operationId":"get_purchase_orders_by_id","summary":"Get one purchase order.","tags":["Purchase orders"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Get one purchase order.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseOrder"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"patch_purchase_orders_by_id","summary":"Update a purchase order.","tags":["Purchase orders"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"Update a purchase order.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseOrder"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["sent","closed"]},"location_id":{"type":"string"},"expected_date":{"type":"string"},"supplier_reference":{"type":"string"},"notes":{"type":"string"}},"required":[],"additionalProperties":false}}}}}},"/purchase_orders/{id}/receipts":{"post":{"operationId":"post_purchase_orders_by_id_receipts","summary":"Receive in full or in part, with freight and duty. Receiving more than ordered needs allow_over_delivery: true, else 422.","tags":["Purchase orders"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"201":{"description":"Receive in full or in part, with freight and duty. Receiving more than ordered needs allow_over_delivery: true, else 422.","content":{"application/json":{"schema":{"type":"object","properties":{"purchase_order":{"$ref":"#/components/schemas/PurchaseOrder"},"movements":{"type":"array","items":{"$ref":"#/components/schemas/StockMovement"}}},"required":["purchase_order","movements"],"additionalProperties":false}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"location_id":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"line_id":{"type":"string"},"sku":{"type":"string"},"quantity":{"type":"integer"}},"required":["quantity"],"additionalProperties":false}},"costs":{"type":"object","properties":{"freight":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"duty":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"other":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."}},"required":[],"additionalProperties":false},"spread_by":{"type":"string","enum":["value","quantity"]},"allow_over_delivery":{"type":"boolean","description":"True to receive more than a line still needs. Left out, an over-delivery is refused with 422."}},"required":["lines"],"additionalProperties":false}}}}}},"/customers":{"get":{"operationId":"get_customers","summary":"List customers.","tags":["Customers"],"parameters":[{"name":"limit","in":"query","required":false,"description":"Records per page, 1 to 250; 50 by default.","schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"description":"The next_cursor from the page before.","schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"description":"Only records changed at or after this date and time.","schema":{"type":"string"}}],"responses":{"200":{"description":"List customers.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}},"has_more":{"type":"boolean"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","has_more","next_cursor"],"additionalProperties":false}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"post_customers","summary":"Create a customer.","tags":["Customers"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"201":{"description":"Create a customer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["trade","online"]},"code":{"type":"string"},"name":{"type":"string"},"contact_name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"currency":{"type":"string","enum":["USD","CAD","GBP","EUR"]},"payment_terms_days":{"type":"integer"},"price_list_id":{"type":"string"},"default_location_id":{"type":"string"},"tax_number":{"type":"string"},"billing_address":{"$ref":"#/components/schemas/Address"},"shipping_address":{"$ref":"#/components/schemas/Address"}},"required":["code","name","currency"],"additionalProperties":false}}}}}},"/customers/{id}":{"get":{"operationId":"get_customers_by_id","summary":"Get one customer.","tags":["Customers"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Get one customer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"patch_customers_by_id","summary":"Update a customer.","tags":["Customers"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"Update a customer.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["trade","online"]},"code":{"type":"string"},"name":{"type":"string"},"contact_name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"currency":{"type":"string","enum":["USD","CAD","GBP","EUR"]},"payment_terms_days":{"type":"integer"},"price_list_id":{"type":"string"},"default_location_id":{"type":"string"},"tax_number":{"type":"string"},"billing_address":{"$ref":"#/components/schemas/Address"},"shipping_address":{"$ref":"#/components/schemas/Address"}},"required":[],"additionalProperties":false}}}}}},"/price_lists":{"get":{"operationId":"get_price_lists","summary":"List price lists.","tags":["Price lists"],"parameters":[{"name":"limit","in":"query","required":false,"description":"Records per page, 1 to 250; 50 by default.","schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"description":"The next_cursor from the page before.","schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"description":"Only records changed at or after this date and time.","schema":{"type":"string"}}],"responses":{"200":{"description":"List price lists.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PriceList"}},"has_more":{"type":"boolean"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","has_more","next_cursor"],"additionalProperties":false}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"post_price_lists","summary":"Create a price list.","tags":["Price lists"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"201":{"description":"Create a price list.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"currency":{"type":"string","enum":["USD","CAD","GBP","EUR"]},"discount_percent":{"type":"number"},"prices":{"type":"array","items":{"type":"object","properties":{"variant_id":{"type":"string"},"sku":{"type":"string"},"unit_price":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"discount_percent":{"type":"number"}},"required":[],"additionalProperties":false}}},"required":["name","currency"],"additionalProperties":false}}}}}},"/price_lists/{id}":{"get":{"operationId":"get_price_lists_by_id","summary":"Get one price list.","tags":["Price lists"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Get one price list.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"patch_price_lists_by_id","summary":"Update a price list.","tags":["Price lists"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"Update a price list.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceList"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"currency":{"type":"string","enum":["USD","CAD","GBP","EUR"]},"discount_percent":{"type":"number"},"prices":{"type":"array","items":{"type":"object","properties":{"variant_id":{"type":"string"},"sku":{"type":"string"},"unit_price":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"discount_percent":{"type":"number"}},"required":[],"additionalProperties":false}}},"required":[],"additionalProperties":false}}}}}},"/sales_orders":{"get":{"operationId":"get_sales_orders","summary":"List sales orders.","tags":["Sales orders"],"parameters":[{"name":"limit","in":"query","required":false,"description":"Records per page, 1 to 250; 50 by default.","schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"description":"The next_cursor from the page before.","schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"description":"Only records changed at or after this date and time.","schema":{"type":"string"}},{"name":"status","in":"query","required":false,"description":"One or more of draft, confirmed, part_picked, picked, part_shipped, backordered, shipped, invoiced, cancelled.","schema":{"type":"string"}},{"name":"customer_id","in":"query","required":false,"description":"Only this customer's orders.","schema":{"type":"string"}},{"name":"customer_reference","in":"query","required":false,"description":"Only orders with exactly this customer_reference, such as a Shopify order number.","schema":{"type":"string"}}],"responses":{"200":{"description":"List sales orders.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SalesOrder"}},"has_more":{"type":"boolean"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","has_more","next_cursor"],"additionalProperties":false}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"post_sales_orders","summary":"Create a sales order.","tags":["Sales orders"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"201":{"description":"Create a sales order.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesOrder"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customer_id":{"type":"string"},"location_id":{"type":"string"},"status":{"type":"string","enum":["draft","confirmed"]},"channel":{"type":"string","enum":["wholesale","online"]},"tax_rate":{"type":"number"},"required_date":{"type":"string"},"customer_reference":{"type":"string"},"reject_duplicate_reference":{"type":"boolean","description":"True to refuse the order with a 409 when another sales order already has this customer_reference."},"notes":{"type":"string"},"shipping_address":{"type":"object","description":"Where this order ships, such as a web order's ship-to. Left out, the customer's shipping address. Its province sets the default tax_rate in Canada (GST or HST); elsewhere, send tax_rate.","properties":{"line1":{"type":"string"},"line2":{"type":"string"},"city":{"type":"string"},"region":{"type":"string","description":"State, province or county code, such as ON or NY."},"postal_code":{"type":"string"},"country":{"type":"string","description":"Two letters, such as CA or US."}},"required":["line1","city","country"],"additionalProperties":false},"billing_address":{"type":"object","description":"Who this order is billed to. Left out, the customer's billing address.","properties":{"line1":{"type":"string"},"line2":{"type":"string"},"city":{"type":"string"},"region":{"type":"string","description":"State, province or county code, such as ON or NY."},"postal_code":{"type":"string"},"country":{"type":"string","description":"Two letters, such as CA or US."}},"required":["line1","city","country"],"additionalProperties":false},"lines":{"type":"array","items":{"type":"object","properties":{"variant_id":{"type":"string"},"sku":{"type":"string"},"quantity":{"type":"integer"},"unit_price":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"discount_percent":{"type":"number"}},"required":["quantity"],"additionalProperties":false}}},"required":["customer_id","lines"],"additionalProperties":false}}}}}},"/sales_orders/{id}":{"get":{"operationId":"get_sales_orders_by_id","summary":"Get one sales order.","tags":["Sales orders"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Get one sales order.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesOrder"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"patch_sales_orders_by_id","summary":"Update a sales order: confirm, cancel, details, or add, change and remove lines. A line cannot go below what has shipped.","tags":["Sales orders"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"Update a sales order: confirm, cancel, details, or add, change and remove lines. A line cannot go below what has shipped.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesOrder"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["confirmed","cancelled"]},"required_date":{"type":"string"},"customer_reference":{"type":"string"},"notes":{"type":"string"},"shipping_address":{"type":"object","description":"Where this order ships. The tax rate on lines already on the order stays as it is.","properties":{"line1":{"type":"string"},"line2":{"type":"string"},"city":{"type":"string"},"region":{"type":"string","description":"State, province or county code, such as ON or NY."},"postal_code":{"type":"string"},"country":{"type":"string","description":"Two letters, such as CA or US."}},"required":["line1","city","country"],"additionalProperties":false},"billing_address":{"type":"object","description":"Who this order is billed to.","properties":{"line1":{"type":"string"},"line2":{"type":"string"},"city":{"type":"string"},"region":{"type":"string","description":"State, province or county code, such as ON or NY."},"postal_code":{"type":"string"},"country":{"type":"string","description":"Two letters, such as CA or US."}},"required":["line1","city","country"],"additionalProperties":false},"lines":{"type":"array","items":{"type":"object","properties":{"line_id":{"type":"string","description":"A line already on the order, to change or remove. Leave it out to add a line."},"variant_id":{"type":"string","description":"For a new line: the item, by id. Or send sku."},"sku":{"type":"string","description":"For a new line: the item, by SKU."},"quantity":{"type":"integer","description":"Units on the line. Required for a new line; left out, a line keeps its quantity. Not below what is picked and shipped on it."},"unit_price":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"discount_percent":{"type":"number"},"remove":{"type":"boolean","description":"True, with line_id, to take the line off the order. A line with units picked or shipped stays."}},"required":[],"additionalProperties":false},"description":"Changes to the order's lines, merged by line_id. A line with line_id is changed; one without is added; one with remove: true is taken off. Lines not sent stay as they are."}},"required":[],"additionalProperties":false}}}}}},"/sales_orders/{id}/picks":{"get":{"operationId":"get_sales_orders_by_id_picks","summary":"List an order's picks and unpicks, newest first: who, how and how many.","tags":["Sales orders"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"List an order's picks and unpicks, newest first: who, how and how many.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SalesOrderPick"}},"has_more":{"type":"boolean"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","has_more","next_cursor"],"additionalProperties":false}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"post_sales_orders_by_id_picks","summary":"Pick units on lines. No stock moves: picked units stay on hand and reserved until they ship.","tags":["Sales orders"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"201":{"description":"Pick units on lines. No stock moves: picked units stay on hand and reserved until they ship.","content":{"application/json":{"schema":{"type":"object","properties":{"sales_order":{"$ref":"#/components/schemas/SalesOrder"}},"required":["sales_order"],"additionalProperties":false}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"lines":{"type":"array","items":{"type":"object","properties":{"line_id":{"type":"string"},"sku":{"type":"string"},"quantity":{"type":"integer","description":"Units picked now. Not past what is still to pick on the line."}},"required":["quantity"],"additionalProperties":false}}},"required":["lines"],"additionalProperties":false}}}}}},"/sales_orders/{id}/unpick":{"post":{"operationId":"post_sales_orders_by_id_unpick","summary":"Return picked units to unpicked, by line, or every picked unit with no lines.","tags":["Sales orders"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"Return picked units to unpicked, by line, or every picked unit with no lines.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesOrder"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"lines":{"type":"array","items":{"type":"object","properties":{"line_id":{"type":"string"},"sku":{"type":"string"},"quantity":{"type":"integer","description":"Units to return to unpicked. Not past what is picked on the line."}},"required":["quantity"],"additionalProperties":false}}},"required":[],"additionalProperties":false}}}}}},"/sales_orders/{id}/shipments":{"post":{"operationId":"post_sales_orders_by_id_shipments","summary":"Ship in full, or ship only what is picked (only_picked) and leave the rest open. Stock leaves here.","tags":["Sales orders"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"201":{"description":"Ship in full, or ship only what is picked (only_picked) and leave the rest open. Stock leaves here.","content":{"application/json":{"schema":{"type":"object","properties":{"sales_order":{"$ref":"#/components/schemas/SalesOrder"},"movements":{"type":"array","items":{"$ref":"#/components/schemas/StockMovement"}}},"required":["sales_order","movements"],"additionalProperties":false}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"only_picked":{"type":"boolean"}},"required":[],"additionalProperties":false}}}}}},"/sales_orders/{id}/close":{"post":{"operationId":"post_sales_orders_by_id_close","summary":"Close what is still open on a part-shipped order and free its reserved stock.","tags":["Sales orders"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"Close what is still open on a part-shipped order and free its reserved stock.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesOrder"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/invoices":{"get":{"operationId":"get_invoices","summary":"List invoices; filter by status or sales_order_id.","tags":["Invoices"],"parameters":[{"name":"limit","in":"query","required":false,"description":"Records per page, 1 to 250; 50 by default.","schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"description":"The next_cursor from the page before.","schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"description":"Only records changed at or after this date and time.","schema":{"type":"string"}},{"name":"status","in":"query","required":false,"description":"One or more of open, paid, void.","schema":{"type":"string"}},{"name":"sales_order_id","in":"query","required":false,"description":"Only the invoices raised from this sales order.","schema":{"type":"string"}}],"responses":{"200":{"description":"List invoices; filter by status or sales_order_id.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Invoice"}},"has_more":{"type":"boolean"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","has_more","next_cursor"],"additionalProperties":false}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/invoices/{id}":{"get":{"operationId":"get_invoices_by_id","summary":"Get one invoice.","tags":["Invoices"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Get one invoice.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invoice"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"patch_invoices_by_id","summary":"Mark an invoice paid or void.","tags":["Invoices"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"Mark an invoice paid or void.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invoice"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["paid","void"]}},"required":["status"],"additionalProperties":false}}}}}},"/sales_orders/{id}/invoice":{"post":{"operationId":"post_sales_orders_by_id_invoice","summary":"Invoice what has shipped and is not yet invoiced. Refused with 422 when there is nothing to bill.","tags":["Invoices"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"201":{"description":"Invoice what has shipped and is not yet invoiced. Refused with 422 when there is nothing to bill.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invoice"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/sales_orders/{id}/returns":{"post":{"operationId":"post_sales_orders_by_id_returns","summary":"Record units sent back on shipped lines: restock at a location, or write off with a reason.","tags":["Returns and credit notes"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"201":{"description":"Record units sent back on shipped lines: restock at a location, or write off with a reason.","content":{"application/json":{"schema":{"type":"object","properties":{"return":{"$ref":"#/components/schemas/SalesReturn"},"movements":{"type":"array","items":{"$ref":"#/components/schemas/StockMovement"}}},"required":["return","movements"],"additionalProperties":false}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"lines":{"type":"array","items":{"type":"object","properties":{"line_id":{"type":"string"},"sku":{"type":"string"},"quantity":{"type":"integer","description":"Units returned. Not past what shipped on the line, less what already came back."},"disposition":{"type":"string","enum":["restock","write_off"]},"location_id":{"type":"string","description":"Where restocked units go; the order's ship-from location when left out."},"reason":{"type":"string","description":"Why units are written off; required for write_off."}},"required":["quantity","disposition"],"additionalProperties":false}},"note":{"type":"string"}},"required":["lines"],"additionalProperties":false}}}}}},"/returns":{"get":{"operationId":"get_returns","summary":"List returns; filter by sales_order_id.","tags":["Returns and credit notes"],"parameters":[{"name":"limit","in":"query","required":false,"description":"Records per page, 1 to 250; 50 by default.","schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"description":"The next_cursor from the page before.","schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"description":"Only records changed at or after this date and time.","schema":{"type":"string"}},{"name":"sales_order_id","in":"query","required":false,"description":"Only the returns against this sales order.","schema":{"type":"string"}}],"responses":{"200":{"description":"List returns; filter by sales_order_id.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SalesReturn"}},"has_more":{"type":"boolean"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","has_more","next_cursor"],"additionalProperties":false}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/returns/{id}":{"get":{"operationId":"get_returns_by_id","summary":"Get one return.","tags":["Returns and credit notes"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Get one return.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesReturn"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/invoices/{id}/credit_notes":{"post":{"operationId":"post_invoices_by_id_credit_notes","summary":"Credit an invoice for a return's units at its prices and tax, or for an amount before tax.","tags":["Returns and credit notes"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"201":{"description":"Credit an invoice for a return's units at its prices and tax, or for an amount before tax.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditNote"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"return_id":{"type":"string","description":"Credit the units on this return that the invoice billed, at its prices and tax."},"amount":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"reason":{"type":"string"}},"required":[],"additionalProperties":false}}}}}},"/credit_notes":{"get":{"operationId":"get_credit_notes","summary":"List credit notes; filter by invoice_id.","tags":["Returns and credit notes"],"parameters":[{"name":"limit","in":"query","required":false,"description":"Records per page, 1 to 250; 50 by default.","schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"description":"The next_cursor from the page before.","schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"description":"Only records changed at or after this date and time.","schema":{"type":"string"}},{"name":"invoice_id","in":"query","required":false,"description":"Only the credit notes against this invoice.","schema":{"type":"string"}}],"responses":{"200":{"description":"List credit notes; filter by invoice_id.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CreditNote"}},"has_more":{"type":"boolean"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","has_more","next_cursor"],"additionalProperties":false}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/credit_notes/{id}":{"get":{"operationId":"get_credit_notes_by_id","summary":"Get one credit note.","tags":["Returns and credit notes"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Get one credit note.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditNote"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/workspace":{"get":{"operationId":"get_workspace","summary":"Get the name, address and tax number on your documents.","tags":["Business details"],"parameters":[],"responses":{"200":{"description":"Get the name, address and tax number on your documents.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Workspace"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/audit_entries":{"get":{"operationId":"get_audit_entries","summary":"List every stock change with before and after, newest first.","tags":["Audit trail"],"parameters":[{"name":"limit","in":"query","required":false,"description":"Records per page, 1 to 250; 50 by default.","schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"description":"The next_cursor from the page before.","schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"description":"Only records changed at or after this date and time.","schema":{"type":"string"}},{"name":"variant_id","in":"query","required":false,"description":"Only this variant.","schema":{"type":"string"}},{"name":"location_id","in":"query","required":false,"description":"Only this location.","schema":{"type":"string"}},{"name":"source","in":"query","required":false,"description":"One of screen, scan, api, import, sync.","schema":{"type":"string"}}],"responses":{"200":{"description":"List every stock change with before and after, newest first.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AuditEntry"}},"has_more":{"type":"boolean"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","has_more","next_cursor"],"additionalProperties":false}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/audit_entries/{id}":{"get":{"operationId":"get_audit_entries_by_id","summary":"Get one audit entry.","tags":["Audit trail"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Get one audit entry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditEntry"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/activity_entries":{"get":{"operationId":"get_activity_entries","summary":"List API writes and webhook deliveries with their results, newest first.","tags":["Integration activity log"],"parameters":[{"name":"limit","in":"query","required":false,"description":"Records per page, 1 to 250; 50 by default.","schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"description":"The next_cursor from the page before.","schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"description":"Only records changed at or after this date and time.","schema":{"type":"string"}},{"name":"source","in":"query","required":false,"description":"One or more of api, webhook, import, sync, app.","schema":{"type":"string"}},{"name":"result","in":"query","required":false,"description":"success or failure.","schema":{"type":"string"}}],"responses":{"200":{"description":"List API writes and webhook deliveries with their results, newest first.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ActivityEntry"}},"has_more":{"type":"boolean"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","has_more","next_cursor"],"additionalProperties":false}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/activity_entries/{id}":{"get":{"operationId":"get_activity_entries_by_id","summary":"Get one activity entry.","tags":["Integration activity log"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Get one activity entry.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivityEntry"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/reports/stock_value":{"get":{"operationId":"get_reports_stock_value","summary":"Stock value by SKU and location, with totals, for today or an as_at day.","tags":["Reports"],"parameters":[{"name":"as_at","in":"query","required":false,"description":"A day, YYYY-MM-DD (UTC): stock and unit cost as at the end of that day, rebuilt from stock movements. Today when left out. Unit cost is a weighted average that includes landed freight and duty.","schema":{"type":"string"}}],"responses":{"200":{"description":"Stock value by SKU and location, with totals, for today or an as_at day.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockValueReport"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/reports/cost_of_goods":{"get":{"operationId":"get_reports_cost_of_goods","summary":"Cost of goods shipped against sales order lines from one day to another, at their cost when shipped.","tags":["Reports"],"parameters":[{"name":"from","in":"query","required":false,"description":"The first day, YYYY-MM-DD (UTC); the first of the to date's month when left out.","schema":{"type":"string"}},{"name":"to","in":"query","required":false,"description":"The last day, YYYY-MM-DD (UTC); today when left out. Units shipped against sales order lines in the range, at their unit cost when shipped. Unit cost is a weighted average that includes landed freight and duty.","schema":{"type":"string"}}],"responses":{"200":{"description":"Cost of goods shipped against sales order lines from one day to another, at their cost when shipped.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CostOfGoodsReport"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/reports/stock_value_journal":{"get":{"operationId":"get_reports_stock_value_journal","summary":"One month's stock value journal: opening and closing value, and each change split by kind, to check against your books.","tags":["Reports"],"parameters":[{"name":"month","in":"query","required":false,"description":"A month, YYYY-MM (UTC); this month when left out. The stock value at the start and end of the month, and each change between, split into receipts, wholesale and web shipments, returns, adjustments, counts, opening balances and average cost rounding. Unit cost is a weighted average that includes landed freight and duty.","schema":{"type":"string"}}],"responses":{"200":{"description":"One month's stock value journal: opening and closing value, and each change split by kind, to check against your books.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockValueJournal"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhook_endpoints":{"get":{"operationId":"get_webhook_endpoints","summary":"List your endpoints.","tags":["Webhook endpoints"],"parameters":[{"name":"limit","in":"query","required":false,"description":"Records per page, 1 to 250; 50 by default.","schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"description":"The next_cursor from the page before.","schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"description":"Only records changed at or after this date and time.","schema":{"type":"string"}}],"responses":{"200":{"description":"List your endpoints.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookEndpoint"}},"has_more":{"type":"boolean"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","has_more","next_cursor"],"additionalProperties":false}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"post_webhook_endpoints","summary":"Add an endpoint and pick its events.","tags":["Webhook endpoints"],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"201":{"description":"Add an endpoint and pick its events.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NewWebhookEndpoint"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"},"events":{"type":"array","items":{"type":"string","enum":["stock_level.updated","stock_movement.created","product.created","product.updated","purchase_order.created","purchase_order.received","sales_order.created","sales_order.updated","sales_order.shipped","invoice.created","sales_order.returned","credit_note.created"]}},"description":{"type":"string"}},"required":["url","events"],"additionalProperties":false}}}}}},"/webhook_endpoints/{id}":{"get":{"operationId":"get_webhook_endpoints_by_id","summary":"Get one endpoint.","tags":["Webhook endpoints"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Get one endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpoint"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"delete_webhook_endpoints_by_id","summary":"Remove an endpoint.","tags":["Webhook endpoints"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"204":{"description":"Remove an endpoint."},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhook_endpoints/{id}/test":{"post":{"operationId":"post_webhook_endpoints_by_id_test","summary":"Send a signed test event of one of its events, and log the exact request.","tags":["Webhook endpoints"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Send the same key on a retry, and the first answer comes back instead of a second write.","schema":{"type":"string","maxLength":255}}],"responses":{"201":{"description":"Send a signed test event of one of its events, and log the exact request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookTest"}}}},"400":{"description":"bad_request: The JSON or a query value could not be read, or a query parameter is unknown.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_api_key: The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"read_only_key: A read-only key tried to write. workspace_read_only: The workspace's plan has ended, so it can be read but not written.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found: No record with that id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"idempotency_key_reused: The Idempotency-Key was sent with a different request. duplicate_reference: Another sales order has that customer_reference, and the request asked to refuse a duplicate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"validation_failed: A field is missing, unknown or out of range, or the record's status does not allow it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited: Over the limit; wait for Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"event":{"type":"string","enum":["stock_level.updated","stock_movement.created","product.created","product.updated","purchase_order.created","purchase_order.received","sales_order.created","sales_order.updated","sales_order.shipped","invoice.created","sales_order.returned","credit_note.created"]}},"required":[],"additionalProperties":false}}}}}}},"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"A workspace API key, from workspace settings."}},"schemas":{"Address":{"type":"object","properties":{"line1":{"type":"string"},"line2":{"type":"string"},"city":{"type":"string"},"region":{"type":"string"},"postal_code":{"type":"string"},"country":{"type":"string"}},"required":["line1","line2","city","region","postal_code","country"],"additionalProperties":false},"Variant":{"type":"object","properties":{"id":{"type":"string"},"product_id":{"type":"string"},"sku":{"type":"string"},"barcode":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"option_values":{"type":"array","items":{"type":"string"}},"unit":{"type":"string"},"unit_cost":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"list_price":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"reorder_point":{"type":"integer"},"reorder_quantity":{"type":"integer"},"supplier_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"supplier_sku":{"anyOf":[{"type":"string"},{"type":"null"}]},"supplier_cost":{"anyOf":[{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},{"type":"null"}]},"archived":{"type":"boolean"},"external_ids":{"type":"object","properties":{},"required":[],"additionalProperties":{"type":"string"}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","product_id","sku","barcode","name","option_values","unit","unit_cost","list_price","reorder_point","reorder_quantity","supplier_id","supplier_sku","supplier_cost","archived","external_ids","created_at","updated_at"],"additionalProperties":false},"Product":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"category":{"type":"string"},"brand":{"type":"string"},"option_names":{"type":"array","items":{"type":"string"}},"archived":{"type":"boolean"},"external_ids":{"type":"object","properties":{},"required":[],"additionalProperties":{"type":"string"}},"variants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"product_id":{"type":"string"},"sku":{"type":"string"},"barcode":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"option_values":{"type":"array","items":{"type":"string"}},"unit":{"type":"string"},"unit_cost":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"list_price":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"reorder_point":{"type":"integer"},"reorder_quantity":{"type":"integer"},"supplier_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"supplier_sku":{"anyOf":[{"type":"string"},{"type":"null"}]},"supplier_cost":{"anyOf":[{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},{"type":"null"}]},"archived":{"type":"boolean"},"external_ids":{"type":"object","properties":{},"required":[],"additionalProperties":{"type":"string"}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","product_id","sku","barcode","name","option_values","unit","unit_cost","list_price","reorder_point","reorder_quantity","supplier_id","supplier_sku","supplier_cost","archived","external_ids","created_at","updated_at"],"additionalProperties":false}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","code","name","description","category","brand","option_names","archived","external_ids","variants","created_at","updated_at"],"additionalProperties":false},"Location":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"kind":{"type":"string","enum":["warehouse","store","shop","3pl"]},"address":{"anyOf":[{"type":"object","properties":{"line1":{"type":"string"},"line2":{"type":"string"},"city":{"type":"string"},"region":{"type":"string"},"postal_code":{"type":"string"},"country":{"type":"string"}},"required":["line1","line2","city","region","postal_code","country"],"additionalProperties":false},{"type":"null"}]},"archived":{"type":"boolean"},"for_trade":{"type":"boolean"},"external_ids":{"type":"object","properties":{},"required":[],"additionalProperties":{"type":"string"}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","code","name","kind","address","archived","for_trade","external_ids","created_at","updated_at"],"additionalProperties":false},"StockLevel":{"type":"object","properties":{"variant_id":{"type":"string"},"sku":{"type":"string"},"location_id":{"type":"string"},"on_hand":{"type":"integer"},"on_order":{"type":"integer"},"reserved":{"type":"integer"},"available_to_sell":{"type":"integer"},"updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["variant_id","sku","location_id","on_hand","on_order","reserved","available_to_sell","updated_at"],"additionalProperties":false},"StockLevelDetail":{"type":"object","properties":{"variant_id":{"type":"string"},"sku":{"type":"string"},"on_hand":{"type":"integer"},"on_order":{"type":"integer"},"reserved":{"type":"integer"},"available_to_sell":{"type":"integer"},"reorder_point":{"type":"integer"},"below_reorder_point":{"type":"boolean"},"locations":{"type":"array","items":{"type":"object","properties":{"location_id":{"type":"string"},"on_hand":{"type":"integer"},"on_order":{"type":"integer"},"reserved":{"type":"integer"},"available_to_sell":{"type":"integer"},"updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["location_id","on_hand","on_order","reserved","available_to_sell","updated_at"],"additionalProperties":false}}},"required":["variant_id","sku","on_hand","on_order","reserved","available_to_sell","reorder_point","below_reorder_point","locations"],"additionalProperties":false},"StockMovement":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["opening","receipt","shipment","adjustment","transfer","return"]},"variant_id":{"type":"string"},"sku":{"type":"string"},"location_id":{"type":"string"},"quantity":{"type":"integer","description":"Units added (positive) or taken out (negative)."},"transfer_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"reason":{"anyOf":[{"type":"string","enum":["count","damage","found","correction","other"]},{"type":"null"}]},"note":{"anyOf":[{"type":"string"},{"type":"null"}]},"source":{"type":"string","enum":["screen","scan","api","import","sync"]},"method":{"anyOf":[{"type":"string","enum":["camera","scanner"]},{"type":"null"}]},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"actor":{"type":"string","description":"A person's name (their email until a name is set), or an API key's name."},"unit_cost":{"anyOf":[{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},{"type":"null"}]},"purchase_order_line_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"sales_order_line_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"at":{"type":"string","format":"date-time"}},"required":["id","kind","variant_id","sku","location_id","quantity","transfer_id","reason","note","source","method","user_id","actor","unit_cost","purchase_order_line_id","sales_order_line_id","at"],"additionalProperties":false},"SalesOrderPick":{"type":"object","properties":{"id":{"type":"string"},"sales_order_id":{"type":"string"},"line_id":{"type":"string"},"variant_id":{"type":"string"},"sku":{"type":"string"},"quantity":{"type":"integer","description":"Units picked; below zero for an unpick."},"source":{"type":"string","enum":["screen","scan","api","import","sync"]},"method":{"anyOf":[{"type":"string","enum":["camera","scanner"]},{"type":"null"}]},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"actor":{"type":"string"},"note":{"anyOf":[{"type":"string"},{"type":"null"}]},"at":{"type":"string","format":"date-time"}},"required":["id","sales_order_id","line_id","variant_id","sku","quantity","source","method","user_id","actor","note","at"],"additionalProperties":false},"Transfer":{"type":"object","properties":{"transfer_id":{"type":"string"},"movements":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["opening","receipt","shipment","adjustment","transfer","return"]},"variant_id":{"type":"string"},"sku":{"type":"string"},"location_id":{"type":"string"},"quantity":{"type":"integer","description":"Units added (positive) or taken out (negative)."},"transfer_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"reason":{"anyOf":[{"type":"string","enum":["count","damage","found","correction","other"]},{"type":"null"}]},"note":{"anyOf":[{"type":"string"},{"type":"null"}]},"source":{"type":"string","enum":["screen","scan","api","import","sync"]},"method":{"anyOf":[{"type":"string","enum":["camera","scanner"]},{"type":"null"}]},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"actor":{"type":"string","description":"A person's name (their email until a name is set), or an API key's name."},"unit_cost":{"anyOf":[{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},{"type":"null"}]},"purchase_order_line_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"sales_order_line_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"at":{"type":"string","format":"date-time"}},"required":["id","kind","variant_id","sku","location_id","quantity","transfer_id","reason","note","source","method","user_id","actor","unit_cost","purchase_order_line_id","sales_order_line_id","at"],"additionalProperties":false}}},"required":["transfer_id","movements"],"additionalProperties":false},"Supplier":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"contact_name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"address":{"anyOf":[{"type":"object","properties":{"line1":{"type":"string"},"line2":{"type":"string"},"city":{"type":"string"},"region":{"type":"string"},"postal_code":{"type":"string"},"country":{"type":"string"}},"required":["line1","line2","city","region","postal_code","country"],"additionalProperties":false},{"type":"null"}]},"currency":{"type":"string"},"payment_terms_days":{"type":"integer"},"lead_time_days":{"anyOf":[{"type":"integer"},{"type":"null"}]},"tax_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"archived":{"type":"boolean"},"external_ids":{"type":"object","properties":{},"required":[],"additionalProperties":{"type":"string"}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","code","name","contact_name","email","phone","address","currency","payment_terms_days","lead_time_days","tax_number","archived","external_ids","created_at","updated_at"],"additionalProperties":false},"PurchaseOrder":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"supplier_id":{"type":"string"},"location_id":{"type":"string"},"status":{"type":"string","enum":["draft","sent","partly_received","received","closed"]},"currency":{"type":"string"},"order_date":{"type":"string","format":"date"},"expected_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"received_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"supplier_reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"line_number":{"type":"integer"},"variant_id":{"type":"string"},"sku":{"type":"string"},"description":{"type":"string"},"quantity":{"type":"integer"},"received_quantity":{"type":"integer"},"over_delivered_quantity":{"type":"integer","description":"Units received beyond what was ordered."},"unit_cost":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"discount_percent":{"type":"number"},"tax_rate":{"type":"number"}},"required":["id","line_number","variant_id","sku","description","quantity","received_quantity","over_delivered_quantity","unit_cost","discount_percent","tax_rate"],"additionalProperties":false}},"subtotal":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"tax":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"total":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","number","supplier_id","location_id","status","currency","order_date","expected_date","received_date","supplier_reference","notes","lines","subtotal","tax","total","created_at","updated_at"],"additionalProperties":false},"Customer":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["trade","online"]},"code":{"type":"string"},"name":{"type":"string"},"contact_name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"billing_address":{"anyOf":[{"type":"object","properties":{"line1":{"type":"string"},"line2":{"type":"string"},"city":{"type":"string"},"region":{"type":"string"},"postal_code":{"type":"string"},"country":{"type":"string"}},"required":["line1","line2","city","region","postal_code","country"],"additionalProperties":false},{"type":"null"}]},"shipping_address":{"anyOf":[{"type":"object","properties":{"line1":{"type":"string"},"line2":{"type":"string"},"city":{"type":"string"},"region":{"type":"string"},"postal_code":{"type":"string"},"country":{"type":"string"}},"required":["line1","line2","city","region","postal_code","country"],"additionalProperties":false},{"type":"null"}]},"currency":{"type":"string"},"payment_terms_days":{"type":"integer"},"price_list_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"default_location_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"tax_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"portal_access":{"type":"boolean"},"archived":{"type":"boolean"},"external_ids":{"type":"object","properties":{},"required":[],"additionalProperties":{"type":"string"}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","kind","code","name","contact_name","email","phone","billing_address","shipping_address","currency","payment_terms_days","price_list_id","default_location_id","tax_number","portal_access","archived","external_ids","created_at","updated_at"],"additionalProperties":false},"PriceList":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"currency":{"type":"string"},"discount_percent":{"type":"number"},"prices":{"type":"array","items":{"type":"object","properties":{"variant_id":{"type":"string"},"unit_price":{"anyOf":[{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},{"type":"null"}]},"discount_percent":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["variant_id","unit_price","discount_percent"],"additionalProperties":false}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","name","currency","discount_percent","prices","created_at","updated_at"],"additionalProperties":false},"SalesOrder":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"customer_id":{"type":"string"},"location_id":{"type":"string"},"price_list_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string","enum":["draft","confirmed","part_picked","picked","part_shipped","backordered","shipped","invoiced","cancelled"],"description":"The status the app shows. part_picked: some units picked, some still to pick. part_shipped: part has shipped and no open unit is short. backordered: some open units are short, since open orders reserve more than the ship-from location has on hand; a fully picked order reads picked. cancelled is shown in the app as Canceled."},"part_picked":{"type":"boolean","description":"True exactly when status is part_picked. Kept for older clients."},"source":{"type":"string","enum":["screen","portal","api","import","sync"]},"channel":{"type":"string","enum":["wholesale","online"]},"currency":{"type":"string"},"order_date":{"type":"string","format":"date"},"required_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"shipped_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"customer_reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"billing_address":{"anyOf":[{"type":"object","properties":{"line1":{"type":"string"},"line2":{"type":"string"},"city":{"type":"string"},"region":{"type":"string"},"postal_code":{"type":"string"},"country":{"type":"string"}},"required":["line1","line2","city","region","postal_code","country"],"additionalProperties":false},{"type":"null"}]},"shipping_address":{"anyOf":[{"type":"object","properties":{"line1":{"type":"string"},"line2":{"type":"string"},"city":{"type":"string"},"region":{"type":"string"},"postal_code":{"type":"string"},"country":{"type":"string"}},"required":["line1","line2","city","region","postal_code","country"],"additionalProperties":false},{"type":"null"}]},"notes":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"line_number":{"type":"integer"},"variant_id":{"type":"string"},"sku":{"type":"string"},"description":{"type":"string"},"quantity":{"type":"integer"},"shipped_quantity":{"type":"integer"},"picked_quantity":{"type":"integer","description":"Units picked and packed, not yet shipped. Still on hand and reserved."},"reserved":{"type":"integer"},"unit_price":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"discount_percent":{"type":"number"},"tax_rate":{"type":"number"}},"required":["id","line_number","variant_id","sku","description","quantity","shipped_quantity","picked_quantity","reserved","unit_price","discount_percent","tax_rate"],"additionalProperties":false}},"subtotal":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"tax":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"total":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","number","customer_id","location_id","price_list_id","status","part_picked","source","channel","currency","order_date","required_date","shipped_date","customer_reference","billing_address","shipping_address","notes","lines","subtotal","tax","total","created_at","updated_at"],"additionalProperties":false},"Invoice":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"sales_order_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"customer_id":{"type":"string"},"status":{"type":"string","enum":["open","paid","void"]},"currency":{"type":"string"},"issue_date":{"type":"string","format":"date"},"due_date":{"type":"string","format":"date"},"payment_terms_days":{"type":"integer"},"customer_reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"billing_address":{"anyOf":[{"type":"object","properties":{"line1":{"type":"string"},"line2":{"type":"string"},"city":{"type":"string"},"region":{"type":"string"},"postal_code":{"type":"string"},"country":{"type":"string"}},"required":["line1","line2","city","region","postal_code","country"],"additionalProperties":false},{"type":"null"}]},"shipping_address":{"anyOf":[{"type":"object","properties":{"line1":{"type":"string"},"line2":{"type":"string"},"city":{"type":"string"},"region":{"type":"string"},"postal_code":{"type":"string"},"country":{"type":"string"}},"required":["line1","line2","city","region","postal_code","country"],"additionalProperties":false},{"type":"null"}]},"notes":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"line_number":{"type":"integer"},"variant_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"sku":{"type":"string"},"description":{"type":"string"},"quantity":{"type":"integer"},"unit_price":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"discount_percent":{"type":"number"},"tax_rate":{"type":"number"},"tax_code":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","line_number","variant_id","sku","description","quantity","unit_price","discount_percent","tax_rate","tax_code"],"additionalProperties":false}},"subtotal":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"tax":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"total":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"credited":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"balance_due":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","number","sales_order_id","customer_id","status","currency","issue_date","due_date","payment_terms_days","customer_reference","billing_address","shipping_address","notes","lines","subtotal","tax","total","credited","balance_due","created_at","updated_at"],"additionalProperties":false},"CreditNote":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"invoice_id":{"type":"string"},"sales_order_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"customer_id":{"type":"string"},"return_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"currency":{"type":"string"},"issue_date":{"type":"string","format":"date"},"reason":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"line_number":{"type":"integer"},"variant_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"sku":{"type":"string"},"description":{"type":"string"},"quantity":{"type":"integer"},"unit_price":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"discount_percent":{"type":"number"},"tax_rate":{"type":"number"},"tax_code":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","line_number","variant_id","sku","description","quantity","unit_price","discount_percent","tax_rate","tax_code"],"additionalProperties":false}},"subtotal":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"tax":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"total":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","number","invoice_id","sales_order_id","customer_id","return_id","currency","issue_date","reason","lines","subtotal","tax","total","created_at","updated_at"],"additionalProperties":false},"SalesReturn":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"sales_order_id":{"type":"string"},"customer_id":{"type":"string"},"return_date":{"type":"string","format":"date"},"note":{"anyOf":[{"type":"string"},{"type":"null"}]},"actor":{"type":"string"},"source":{"type":"string","enum":["screen","scan","api","import","sync"]},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"line_number":{"type":"integer"},"sales_order_line_id":{"type":"string"},"variant_id":{"type":"string"},"sku":{"type":"string"},"description":{"type":"string"},"quantity":{"type":"integer"},"disposition":{"type":"string","enum":["restock","write_off"]},"location_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"unit_cost":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"movement_id":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","line_number","sales_order_line_id","variant_id","sku","description","quantity","disposition","location_id","reason","unit_cost","movement_id"],"additionalProperties":false}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","number","sales_order_id","customer_id","return_date","note","actor","source","lines","created_at","updated_at"],"additionalProperties":false},"Workspace":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"business_name":{"type":"string"},"address":{"anyOf":[{"type":"object","properties":{"line1":{"type":"string"},"line2":{"type":"string"},"city":{"type":"string"},"region":{"type":"string"},"postal_code":{"type":"string"},"country":{"type":"string"}},"required":["line1","line2","city","region","postal_code","country"],"additionalProperties":false},{"type":"null"}]},"tax_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"logo_url":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","business_name","address","tax_number","logo_url"],"additionalProperties":false},"AuditEntry":{"type":"object","properties":{"id":{"type":"string"},"at":{"type":"string","format":"date-time"},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"actor":{"type":"string"},"source":{"type":"string","enum":["screen","scan","api","import","sync"]},"method":{"anyOf":[{"type":"string","enum":["camera","scanner"]},{"type":"null"}]},"action":{"type":"string"},"record_type":{"type":"string"},"record_id":{"type":"string"},"location_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"variant_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"sku":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity_before":{"anyOf":[{"type":"integer"},{"type":"null"}]},"quantity_after":{"anyOf":[{"type":"integer"},{"type":"null"}]},"reason":{"anyOf":[{"type":"string","enum":["count","damage","found","correction","other"]},{"type":"null"}]},"note":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","at","user_id","actor","source","method","action","record_type","record_id","location_id","variant_id","sku","quantity_before","quantity_after","reason","note"],"additionalProperties":false},"ActivityEntry":{"type":"object","properties":{"id":{"type":"string"},"at":{"type":"string","format":"date-time"},"source":{"type":"string","enum":["api","webhook","import","sync","app"]},"actor":{"type":"string"},"api_key_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"action":{"type":"string"},"record_type":{"anyOf":[{"type":"string"},{"type":"null"}]},"record_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"result":{"type":"string","enum":["success","failure"]},"status":{"anyOf":[{"type":"integer"},{"type":"null"}]},"message":{"type":"string"},"request":{"anyOf":[{"type":"object","properties":{"url":{"type":"string"},"headers":{"type":"object","properties":{},"required":[],"additionalProperties":{"type":"string"},"description":"Each header sent, by name."},"body":{"type":"string","description":"The exact body, as signed."}},"required":["url","headers","body"],"additionalProperties":false},{"type":"null"}]}},"required":["id","at","source","actor","api_key_id","action","record_type","record_id","result","status","message","request"],"additionalProperties":false},"WebhookEndpoint":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"},"description":{"type":"string"},"events":{"type":"array","items":{"type":"string","enum":["stock_level.updated","stock_movement.created","product.created","product.updated","purchase_order.created","purchase_order.received","sales_order.created","sales_order.updated","sales_order.shipped","invoice.created","sales_order.returned","credit_note.created"]}},"created_at":{"type":"string","format":"date-time"}},"required":["id","url","description","events","created_at"],"additionalProperties":false},"WebhookTest":{"type":"object","properties":{"id":{"type":"string","description":"The test event's id, as in Webhook-Id."},"endpoint_id":{"type":"string"},"event":{"type":"string","enum":["stock_level.updated","stock_movement.created","product.created","product.updated","purchase_order.created","purchase_order.received","sales_order.created","sales_order.updated","sales_order.shipped","invoice.created","sales_order.returned","credit_note.created"]},"test":{"type":"boolean","description":"Always true."},"body":{"type":"string","description":"The exact body, as signed: verify the signature against this text."},"payload":{"type":"object","properties":{},"required":[],"additionalProperties":true,"description":"The body, parsed: id, type, created_at, test and data."},"headers":{"type":"object","properties":{},"required":[],"additionalProperties":{"type":"string"},"description":"The headers sent, Webhook-Id, Webhook-Timestamp and Webhook-Signature among them."},"result":{"type":"object","properties":{"sent":{"type":"boolean","description":"False in the demo and when the URL was refused before any request."},"recorded_only":{"type":"boolean","description":"True in the demo: recorded, never sent."},"status":{"anyOf":[{"type":"integer"},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["sent","recorded_only","status","error"],"additionalProperties":false},"activity_entry_id":{"type":"string"}},"required":["id","endpoint_id","event","test","body","payload","headers","result","activity_entry_id"],"additionalProperties":false},"NewWebhookEndpoint":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"},"description":{"type":"string"},"events":{"type":"array","items":{"type":"string","enum":["stock_level.updated","stock_movement.created","product.created","product.updated","purchase_order.created","purchase_order.received","sales_order.created","sales_order.updated","sales_order.shipped","invoice.created","sales_order.returned","credit_note.created"]}},"created_at":{"type":"string","format":"date-time"},"secret":{"type":"string","pattern":"^whsec_","description":"The signing secret, shown only in this answer."}},"required":["id","url","description","events","created_at","secret"],"additionalProperties":false},"StockValueReport":{"type":"object","properties":{"as_at":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}]},"currency":{"type":"string"},"costing_method":{"type":"object","properties":{"id":{"type":"string"},"description":{"type":"string"}},"required":["id","description"],"additionalProperties":false},"total_units":{"type":"integer"},"total_value":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"locations":{"type":"array","items":{"type":"object","properties":{"location_id":{"type":"string"},"name":{"type":"string"},"units":{"type":"integer"},"value":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."}},"required":["location_id","name","units","value"],"additionalProperties":false}},"data":{"type":"array","items":{"type":"object","properties":{"variant_id":{"type":"string"},"sku":{"type":"string"},"name":{"type":"string"},"location_id":{"type":"string"},"on_hand":{"type":"integer"},"unit_cost":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"value":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."}},"required":["variant_id","sku","name","location_id","on_hand","unit_cost","value"],"additionalProperties":false}}},"required":["as_at","currency","costing_method","total_units","total_value","locations","data"],"additionalProperties":false},"StockValueJournal":{"type":"object","properties":{"month":{"type":"string","pattern":"^\\d{4}-\\d{2}$","description":"The month, YYYY-MM."},"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"},"month_open":{"type":"boolean","description":"True while the month is not over: the figures run to today, and the journal entries are still dated the month's last day."},"currency":{"type":"string"},"costing_method":{"type":"object","properties":{"id":{"type":"string"},"description":{"type":"string"}},"required":["id","description"],"additionalProperties":false},"opening_value":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","enum":["receipts","shipments_wholesale","shipments_web","returns","adjustments","counts","opening_balances","rounding"]},"units":{"type":"integer"},"value":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"movements":{"type":"integer"}},"required":["id","units","value","movements"],"additionalProperties":false}},"net_change":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"closing_value":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"stock_value_here":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."}},"required":["month","from","to","month_open","currency","costing_method","opening_value","lines","net_change","closing_value","stock_value_here"],"additionalProperties":false},"CostOfGoodsReport":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"},"currency":{"type":"string"},"costing_method":{"type":"object","properties":{"id":{"type":"string"},"description":{"type":"string"}},"required":["id","description"],"additionalProperties":false},"total_units":{"type":"integer"},"total_cost":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"by_sku":{"type":"array","items":{"type":"object","properties":{"variant_id":{"type":"string"},"sku":{"type":"string"},"name":{"type":"string"},"quantity":{"type":"integer"},"cost":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."}},"required":["variant_id","sku","name","quantity","cost"],"additionalProperties":false}},"data":{"type":"array","items":{"type":"object","properties":{"movement_id":{"type":"string"},"shipped_at":{"type":"string","format":"date-time"},"sales_order_id":{"anyOf":[{"type":"string"},{"type":"null"}]},"order_number":{"type":"string"},"variant_id":{"type":"string"},"sku":{"type":"string"},"location_id":{"type":"string"},"kind":{"type":"string","enum":["shipment","return"]},"quantity":{"type":"integer"},"unit_cost":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"cost":{"type":"string","pattern":"^-?\\d+\\.\\d{2}$","description":"A decimal amount, two places."},"cost_source":{"type":"string","enum":["recorded","derived"]}},"required":["movement_id","shipped_at","sales_order_id","order_number","variant_id","sku","location_id","kind","quantity","unit_cost","cost","cost_source"],"additionalProperties":false}}},"required":["from","to","currency","costing_method","total_units","total_cost","by_sku","data"],"additionalProperties":false},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"field":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}