{ "type":"object", "title": "credit_note", "description": "A credit note", "properties":{ "id":{ "description":"Unique identifier - UUID", "identity":true, "readonly":true, "type":"string", "maxLength": 22, "minLength":22 }, "number":{ "description": "Unique number assigned by SK credit note number schema. Auto-assigned when document is opened. Required unless doc status is draft.", "type":"string", "maxLength": 50 }, "address_field":{ "description": "Address field with the receiver. Shown in envelope window.", "type":"string" }, "date":{ "description": "Date the credit note is issued. Automatically set when document is opened. Required unless doc status is draft.", "format":"date", "type":"string" }, "due_days":{ "description": "Used to calculate the due date of the credit note. Useless if date and due date are present.", "type":"integer" }, "due_date":{ "description": "Auto-calculated from date + due days if empty and the document is opened.", "format":"date", "type":"string" }, "status":{ "description": "Defaults to draft for new documents, unless otherwise stated. For new documents with status 'open' or 'closed' or doc where the status changes away from draft, following fields are set if empty: number(next in number schema), date(today), due date(due_days must be given). Only draft documents can be deleted.", "default":"draft", "enum":["draft","open","closed"], "type":"string" }, "external_ref":{ "description": "Some external reference, whatever this may be.", "type":"string", "maxLength": 255 }, "payment_method":{ "description": "How the document is being payed. Used for new payments.", "enum":["cash","bank_transfer","credit_card","paypal","direct_debit","cheque", "moneybookers", "premium_sms"], "type":"string" }, "title":{ "description": "The headline of a document. Use SK placeholders to prevent excessive typing e.g. 'Your credit note [number]'", "type":"string", "maxLength": 255 }, "notes_before":{ "description": "Notes shown before the line items. Normally contains salutation and other introductional information. SK placeholders can be used.", "type":"string", "format":"text" }, "notes_after":{ "description": "Notes shown after the line items. Can contain information about payments, bank account or a thank-you message. SK placeholders can be used.", "type":"string", "format":"text" }, "tag_list":{ "description": "Space separated list of tags. Are split and saved as Tag objects on create, update.", "type":"string" }, "language":{ "description": "Should be a valid language short-code: de-DE, fr, en-GB; like defined in your account language menu. When the document is emailed or printed, a localized version of a multi-language template(email, pdf) will be used if available. Defaults to the clients language, if empty and a client is assigned.", "type":"string", "maxLength": 10 }, "archived_pdf":{ "description": "Archived PDF version of the document. Is created when an document is printed and archived. A document can have multiple archived versions. This only returns the most recent one. ", "readonly":true, "type":"object", "properties":{"$ref":"./attachment.json#properties"} }, "client":{ "description": "The client for the document. You cannot create a client through this, use client_id field to set it.", "readonly":true, "type":"object", "properties":{"$ref":"./client.json#properties"} }, "client_id":{ "description": "The clients uuid. If a new client is assigned its language, address field, due days and cash discount are used if those fields are not set.", "type":"string", "maxLength": 22, "minLength":22 }, "team_id":{ "description": "A team uuid. If set only the team and its parent teams can see the record.", "type":"string", "maxLength": 22, "minLength":22 }, "line_items":{ "description": "Line items for the document", "type":"array", "properties":{"$ref":"./line_item.json#properties"} }, "created_at":{ "description": "Date the object was created in SK. Never changes afterwards.", "format":"date-time", "readonly":true, "type":"string" }, "updated_at":{ "description": "Date the object was edited in SK.", "format":"date-time", "readonly":true, "type":"string" }, "lock_version":{ "description": "Auto-incremented to prevent concurrent updates. First save wins.", "type":"integer" }, "price_total":{ "description": "Deprecated use net_total_base", "readonly":true, "type":"number" }, "price_tax":{ "description": "Deprecated: use tax_total", "readonly":true, "type":"number" }, "gross_total":{ "description": "Gross total of all line items, 2 decimals places", "readonly":true, "type":"number" }, "tax_total":{ "description": "Tax total, 2 decimals places", "readonly":true, "type":"number" }, "net_total":{ "description": "Net total, 2 decimals places", "readonly":true, "type":"number" }, "net_total_base":{ "description": "Net total, 6 decimal places incl. discount", "readonly":true, "type":"number" } }, "links":[ { "rel": "self", "href": "credit_notes/{id}" }, { "rel": "instances", "href": "credit_notes", "properties" : { "page":{ "title" : "Page", "description": "In paginated results set the page to look for", "type":"number" }, "per_page":{ "title" : "Per page", "description": "Results per page. Default is 10, max is 100", "type":"number" }, "filter[q]":{ "title" : "Search", "description": "Search in title, number, address field", "type":"string" }, "filter[number]":{ "title" : "Number", "description": "Find by exact number", "type":"string" }, "filter[tags]":{ "title" : "Tags", "description": "Filter by a space delimited list of tags", "type":"string" }, "filter[from]":{ "title" : "From date", "description": "Objects with a date on and after the date", "type" :"date" }, "filter[to]":{ "title" : "To date", "description": "Objects with date before and on the date", "type" :"date" }, "filter[created_at_from]":{ "title" : "From date", "description": "Objects with a creation date after the date, including given datetime. ISO 8601 format YYY-MM-DDThh:mm:ss+z", "format" : "date-time", "type" : "string" }, "filter[created_at_to]":{ "title" : "To date", "description": "Objects with a creation date before the date, including given datetime. ISO 8601 format YYY-MM-DDThh:mm:ss+z", "format" : "date-time", "type" : "string" }, "filter[languages]":{ "title" : "Languages", "description": "A list of language codes, comma separated", "type" : "string" }, "filter[client_ids]":{ "title" : "Clients", "description": "A single or a list of client uuids, comma separated", "type" : "string" }, "filter[ids]":{ "title" : "Documents", "description": "A single or a list of document uuids, comma separated", "type" : "string" }, "filter[creator_ids]":{ "title" : "Creator", "description": "Objects created by the given users uuids, comma separated", "type" : "string" }, "sort_by":{ "title" : "Sort by", "description": "Sort the results by the given field => number", "enum":["title", "number", "created_at", "updated_at", "client_id", "price_total", "price_tax", "date", "due_date"], "type": "string" }, "sort":{ "title" : "Sort", "enum":["ASC","DESC"], "description": "Sort the results in ASC or DESC" } } }, { "rel": "destroy", "href": "credit_notes/{id}", "method": "DELETE" }, { "rel": "update", "href": "credit_notes/{id}", "method": "PUT" }, { "rel": "create", "href": "credit_notes", "method": "POST", "properties" : { "source" : { "title" : "Source document id", "description": "Copies the source document(excl. number,date) and returns a new draft document." }, "cancel" : { "title" : "Cancel an credit note", "description": "Cancelling a document negates its line item values. A source id must be set.", "dependencies": ["source"] } } }, { "rel": "attachments", "href": "credit_notes/{id}/attachments" }, { "rel": "payments", "href": "credit_notes/{id}/payments" }, { "rel": "comments", "href": "credit_notes/{id}/comments" }, { "rel": "emails", "href": "credit_notes/{id}/emails" }, { "rel": "print", "href": "credit_notes/{id}/print", "method": "POST", "properties" : { "template_id" : { "title" : "PDF template used for printing", "description": "UUID of a pdf template used to print the document. MUST be present", "required":true }, "base64" : { "title" : "Return the created pdf base64 encoded", "description": "If set the new pdf is returned inside the attachment JSON within 'base64' key. Leave empty to save traffic." } } } ] }