-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathinvoice.json
More file actions
413 lines (413 loc) · 15.1 KB
/
invoice.json
File metadata and controls
413 lines (413 loc) · 15.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
{ "type":"object",
"title": "invoice",
"name": "invoice",
"description": "An invoice",
"properties":{
"id":{
"description":"Unique identifier - UUID",
"identity":true,
"readonly":true,
"type":"string",
"maxLength": 22,
"minLength": 22
},
"number":{
"description": "Unique number assigned by SK invoice number schema. Auto-assigned when invoice is opened. Required unless doc status is draft.",
"type":"string",
"maxLength": 50
},
"address_field":{
"description": "Receiver address, normally shown in envelope window. Defaults to client address_field if empty and client_id given.",
"type":"string"
},
"date":{
"description": "Date the invoice is issued. Automatically set when invoice is opened. Required for non-draft documents. YYYY-MM-DD",
"format":"date",
"type":"string"
},
"due_days":{
"description": "Used to calculate the due date of the document. 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. YYYY-MM-DD",
"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. Beware that the overdue-status is virtual as it depends on the real status=open and the document date.",
"default":"draft",
"enum":["draft","open","closed","overdue"],
"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 in 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 invoice [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
},
"currency":{
"description": "Currency code as defined by the ISO 4217 standard (3-letter UPCASE: EUR, USD)",
"type":"string",
"maxLength": 3,
"minLength": 3
},
"exchange_rate":{
"description": "The exchange rate from the foreign document currency(eg. USD) to the company currency(EUR). If the rate is empty we use the exchange rate on the document date or today if doc.date is empty. If there is no rate for this day, say on weekends, the closest previous day is taken(Sunday->Friday). If you open the doc at a later time make sure to manually refresh the rate, as we dont change it. ",
"readonly":true,
"type":"number"
},
"gross_total_exchanged":{
"description": "Exchanged gross total, in your company currency.",
"readonly":true,
"type":"number"
},
"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"}
},
"sepa_mandate_id":{
"description": "SEPA mandate identifier needed in direct debit transactions. This is a unique id given by you to the customer beforehand.",
"type":"string",
"maxLength": 35
},
"sepa_mandate_signed_at":{
"description": "Date the SEPA mandate was signed by your customer. Must not be in the future!",
"format":"date",
"type":"string"
},
"sepa_debit_sequence_type":{
"description": "SEPA direct debit sequence type. Check with you bank how they handle FRST(first) and FNAL(final) types. When exporting SEPA debit to your bank the type defaults to OOF if blank.",
"type":"string",
"enum":["FRST","OOFF","RCUR","FNAL"]
},
"client":{
"description": "DEPRECATED: use contact",
"readonly":true,
"type":"object",
"properties":{"$ref":"./client.json#properties"}
},
"client_id":{
"description": "DEPRECATED: use contact_id",
"type":"string",
"maxLength": 22,
"minLength":22
},
"contact":{
"description": "The contact for the document. Use contact_id field to set a contact.",
"readonly":true,
"type":"object",
"properties":{"$ref":"./contact.json#properties"}
},
"contact_id":{
"description": "The contact uuid. When assigning a contact its language, currency, address_field (due days, cash discount) values are used for the document if those doc-fields are not set.",
"type":"string",
"maxLength": 22,
"minLength":22
},
"team_id":{
"description": "A team uuid taken from the contact. If set only the team and its parent teams can see the record.",
"readonly" :true,
"type":"string",
"maxLength": 22,
"minLength":22
},
"line_items":{
"description": "DEPRECATED use items",
"type":"array",
"properties":{"$ref":"./line_item.json#properties"}
},
"items":{
"description": "Items for the document. Access items of all types including divider and sub_total items. GOTCHAs when using items instead of line_items: You MUST set the type field(CamelCasesItem class name) on each item. You cannot use both, the line_items array is stronger for backward compat.",
"type":"array",
"default": "any",
"minItems": 0,
"items": [{ "$ref": "./line_item.json#properties"},
{ "$ref": "./divider_item.json#properties"},
{ "$ref": "./sub_total_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 and increments version. ",
"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 in document currency.",
"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"
},
"cost_total":{
"description": "Cost total of all line items, 2 decimals places in document currency.",
"readonly":true,
"type":"number"
},
"gross_margin_total":{
"description": "Total gross margin across all line items. Calculated from net_total-cost_total.",
"readonly":true,
"type":"number"
},
"gross_margin_pct":{
"description": "Percentage of gross profit to cost of items sold. Calculated from gross_margin_total/net_total*100",
"readonly":true,
"type":"number"
},
"recurring_id":{
"description":"Recurring document ID, if the invoice was created from a recurring.",
"readonly":true,
"type":"string",
"maxLength": 22,
"minLength": 22
},
"tax_exemption_id":{
"description": "ID of a tax exemption. When set all item taxes are omitted.",
"type":"string",
"maxLength": 22,
"minLength":22
}
},
"links":[
{ "rel": "self",
"href": "invoices/{id}"
},
{ "rel": "instances",
"href": "invoices",
"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 50, max is 200",
"type":"number"
},
"filter[q]":{
"title" : "Search",
"description": "Search in title, number, address field",
"type":"string"
},
"filter[status]":{
"title" : "Status",
"description": "A single or a list of status, comma separated: open,closed,overdue,draft",
"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 after the date. YYYY-MM-DD",
"format" : "date",
"type" : "string"
},
"filter[to]":{
"title" : "To date",
"description": "Objects with date before the date. YYYY-MM-DD",
"format" : "date",
"type" : "string"
},
"filter[languages]":{
"title" : "Languages",
"description": "A list of language codes, comma separated",
"type" : "string"
},
"filter[client_ids]":{
"title" : "Clients",
"description": "DEPRECATED use contact_ids",
"type" : "string"
},
"filter[contact_ids]":{
"title" : "Contacts",
"description": "Find objects belonging to a single or a list of contacts, use ids 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"
},
"filter[recurring_ids]":{
"title" : "Recurrings",
"description": "Documents belonging to the given recurring uuids, comma separated",
"type" : "string"
},
"filter[product_ids]":{
"title" : "Products",
"description": "Documents using the given product uuids(comma separated) in their line items.",
"type" : "string"
},
"sort_by":{
"title" : "Sort by",
"description": "Sort the results by the given field => number",
"enum":["title", "number", "created_at", "updated_at", "price_total", "price_tax", "date", "due_date"],
"type": "string"
},
"sort":{
"title" : "Sort",
"enum":["ASC","DESC"],
"description": "Sort the results in ASC or DESC",
"type": "string"
}
}
},
{ "rel": "destroy",
"href": "invoices/{id}",
"method": "DELETE"
},
{ "rel": "update",
"href": "invoices/{id}",
"method": "PUT"
},
{ "rel": "create",
"href": "invoices",
"method": "POST",
"properties" : {
"source" : {
"title" : "Source document id",
"description": "Copies the source(excl. number,date) and returns a new draft document. Fields passed with the object(e.g. notes, title, address_field) are not overwritten. When copying a different document type e.g. creating an invoice from an order(pass an order ID), ONLY the items, contact, currency and tag list are taken from the source doc.",
"type" : "string"
},
"cancel" : {
"title" : "Cancel an invoice",
"description": "Cancelling a document copies the source and negates all line item values. A source id MUST be set.",
"dependencies": ["source"],
"type":"boolean"
}
}
},
{ "rel": "attachments",
"href": "invoices/{id}/attachments"
},
{ "rel": "payments",
"href": "invoices/{id}/payments"
},
{ "rel": "payment_reminders",
"href": "invoices/{id}/payment_reminders"
},
{ "rel": "comments",
"href": "invoices/{id}/comments"
},
{ "rel": "emails",
"href": "invoices/{id}/emails"
},
{ "rel": "emails create",
"href": "invoices/{id}/emails",
"method": "POST",
"properties" : {
"template_id":{
"title" : "Template",
"description": "UUID of an email template to use. If present template fields like subject, body, attachments are used for the current email.",
"type":"string",
"maxLength": 22,
"minLength":22
},
"send":{
"title" : "Send email",
"description": "Schedule email for sending. Omit this parameter or set value to 0 or false(String or Integer) to keep email as draft."
},
"archived_pdf":{
"title" : "Attach archived pdf",
"description": "Adds the archived pdf from the related resource(if it has one)."
}
}
},
{ "rel": "payment create",
"href": "invoices/{id}/payments",
"method": "POST"
},
{ "rel": "print",
"href": "invoices/{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(any val) the new pdf is returned inside the attachment JSON within 'base64' key. Ommit to save traffic."
}
}
}
]
}