{"openapi":"3.1.0","info":{"title":"Aira för Fortnox, Öppna API:t","version":"1","description":"Read and write your company’s book in Aira för Fortnox. Authenticate with an API key made in Inställningar, sent as `Authorization: Bearer <key>`. Errors are `{ \"error\": { \"code\", \"message\" } }`. Every answer carries `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset`."},"servers":[{"url":"/api/v1"}],"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"`read`: Read the company’s book (läsa).\n`write_aira`: Write what lives in Aira alone: leads, contacts, deals, notes, tasks (skriva i Aira).\n`write_fortnox`: Graduate deals into Fortnox, cancel agreements and change an agreement row’s antal. Only a Fortnox sysadmin can give it (skriva till Fortnox)."}},"schemas":{"Error":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}},"paths":{"/me":{"get":{"operationId":"getMe","summary":"Who this API key acts as","description":"The company the key belongs to and the member who made it. Everything the key does is done as that member.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"company":{"type":"object","properties":{"database_number":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"name":{"type":"string"},"organization_number":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["database_number","name","organization_number"],"additionalProperties":false},"member":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"},"email":{"type":"string"}},"required":["id","name","email"],"additionalProperties":false},"api_key":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"scopes":{"type":"array","items":{"type":"string","enum":["read","write_aira","write_fortnox"]}}},"required":["id","scopes"],"additionalProperties":false}},"required":["company","member","api_key"],"additionalProperties":false}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/parties":{"get":{"operationId":"listParties","summary":"List parties","description":"The companies and persons in the book, customers, suppliers and leads, oldest change first. Page with `next_cursor`; a sync passes the last time it ran as `changed_since`. With `scheme` and `value`, the party holding that identifier, such as the `external_id` it was posted with.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"changed_since","in":"query","required":false,"description":"Only records that changed at or after this time (ISO 8601). Removals are not listed.","schema":{"description":"Only records that changed at or after this time (ISO 8601). Removals are not listed.","type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"cursor","in":"query","required":false,"description":"The `next_cursor` of the previous page. Leave it out for the first page.","schema":{"description":"The `next_cursor` of the previous page. Leave it out for the first page.","type":"string","maxLength":200}},{"name":"limit","in":"query","required":false,"description":"Records per page, 1 to 500.","schema":{"default":100,"description":"Records per page, 1 to 500.","type":"integer","minimum":1,"maximum":500}},{"name":"scheme","in":"query","required":false,"description":"With `value`: only the party holding this identifier, e.g. `org_number`.","schema":{"description":"With `value`: only the party holding this identifier, e.g. `org_number`.","type":"string","maxLength":40}},{"name":"value","in":"query","required":false,"description":"With `scheme`: the identifier’s value, e.g. an id of your own system.","schema":{"description":"With `scheme`: the identifier’s value, e.g. an id of your own system.","type":"string","maxLength":200}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"kind":{"anyOf":[{"type":"string","enum":["company","person"]},{"type":"null"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"anyOf":[{"type":"string","enum":["customer","lost_customer","lead"]},{"type":"null"}],"description":"customer (Kund): from its first invoice, a one-off purchase too, until its last purchase is both more than 2 of its rhythms ago and at least 3 months ago, so it has gone more than twice as long as it usually does without buying. The rhythm is its own köpmönster or, when slower, the rhythm the company’s customers keep for the articles on that purchase. A last purchase 2 or more times its usual size moves that line to 2 times its size in rhythms (three times the usual: 6 rhythms). An agreement in återkommande fakturering in force (running or paused, not past its end date) keeps a customer a Kund however long since it bought; an ended last agreement with no purchase after it makes a Tappad kund. Without a köpmönster of its own, a one-off buyer too, a customer is measured by the rhythm the company’s customers keep for the articles it bought; without one, by the company’s usual rhythm, never faster than every 3 months (so a Tappad kund after at least 6 months); and only without either, by 12 months since its last purchase. lost_customer (Tappad kund): past that line: it bought before, or held an agreement that ended. lead: never invoiced and no agreement, in Fortnox or only in Aira. Null for a party that is only a supplier. Read from the invoicing and the agreements, so a change of status alone does not move `updated_at`."},"roles":{"type":"array","items":{"type":"string","enum":["customer","supplier"]},"description":"What the party is in Fortnox. Empty for a lead only in Aira."},"organization_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"identifiers":{"type":"array","items":{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},"description":"Org nr, VAT number, personnummer and any other `(scheme, value)` the party holds."},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"addresses":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["postal","delivery","visiting"],"description":"postal (invoice), delivery or visiting."},"lines":{"type":"array","items":{"type":"string"}},"zip_code":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"anyOf":[{"type":"string"},{"type":"null"}]},"country_code":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO 3166-1 alpha-2."},"country_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"recipient_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["kind","lines","zip_code","city","country_code","country_name","recipient_name","phone"],"additionalProperties":false}},"owner":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"The member linked to the party’s Kundansvarig, who gets what a program writes on it without naming anyone. Null when it belongs to the whole team, or its säljare is linked to no member."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$","description":"When its details last changed, to the microsecond. What `changed_since` reads."}},"required":["id","kind","name","status","roles","organization_number","identifiers","email","phone","addresses","owner","created_at","updated_at"],"additionalProperties":false}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next_cursor"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createParty","summary":"Find or create a party","description":"A company or person, returned as `/parties/{id}` reads it. A company whose `organization_number`, or a person whose `email`, the book already holds is that party, then one holding the `external_id`: it is returned unchanged (201 only when it was made), with the `external_id` added. A new party is a lead, written by the key’s maker but nobody’s customer: it has no Kundansvarig and belongs to the whole team until a member takes it. A Swedish org nr is matched once against the company register, as when a lead is made on screen.\n\nScope: `write_aira`.","security":[{"apiKey":["write_aira"]}],"x-scope":"write_aira","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, up to 255 characters. The same key sent again with the same request within a day replays the first success, with `Idempotent-Replayed: true`, instead of writing twice; a refused call keeps nothing, so a corrected one may reuse its key. Sent with a different request after a success it is refused (422).","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"kind":{"type":"string","enum":["company","person"]},"name":{"type":"string","minLength":1,"maxLength":500},"organization_number":{"description":"A company’s org nr: the party it names is the one returned.","anyOf":[{"type":"string","maxLength":40},{"type":"null"}]},"country_code":{"default":"SE","description":"ISO 3166-1 alpha-2, `SE` if left out.","type":"string"},"email":{"description":"A person’s email names the person returned.","anyOf":[{"type":"string","maxLength":320,"format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]},"addresses":{"default":[],"maxItems":3,"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["postal","visiting","delivery"],"description":"postal (invoice), delivery or visiting."},"lines":{"default":[],"maxItems":3,"type":"array","items":{"type":"string","maxLength":500}},"zip_code":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]},"city":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]},"country_code":{"description":"ISO 3166-1 alpha-2.","anyOf":[{"type":"string","minLength":2,"maxLength":2},{"type":"null"}]},"country_name":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]},"recipient_name":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]},"phone":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]}},"required":["kind"]}},"external_id":{"type":"object","properties":{"scheme":{"type":"string","pattern":"^[a-z][a-z0-9_.-]{0,39}$","description":"Your system’s name, lowercase, e.g. `aira` or `hubspot`."},"value":{"type":"string","minLength":1,"maxLength":200,"description":"The party’s id in your system."}},"required":["scheme","value"],"description":"An id of your own system, stored on the party: post it again, or list `/parties?scheme=&value=`, to find the same party."}},"required":["kind","name"]}}}},"responses":{"200":{"description":"OK: the record was already in the book, and this is it.","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"kind":{"anyOf":[{"type":"string","enum":["company","person"]},{"type":"null"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"anyOf":[{"type":"string","enum":["customer","lost_customer","lead"]},{"type":"null"}],"description":"customer (Kund): from its first invoice, a one-off purchase too, until its last purchase is both more than 2 of its rhythms ago and at least 3 months ago, so it has gone more than twice as long as it usually does without buying. The rhythm is its own köpmönster or, when slower, the rhythm the company’s customers keep for the articles on that purchase. A last purchase 2 or more times its usual size moves that line to 2 times its size in rhythms (three times the usual: 6 rhythms). An agreement in återkommande fakturering in force (running or paused, not past its end date) keeps a customer a Kund however long since it bought; an ended last agreement with no purchase after it makes a Tappad kund. Without a köpmönster of its own, a one-off buyer too, a customer is measured by the rhythm the company’s customers keep for the articles it bought; without one, by the company’s usual rhythm, never faster than every 3 months (so a Tappad kund after at least 6 months); and only without either, by 12 months since its last purchase. lost_customer (Tappad kund): past that line: it bought before, or held an agreement that ended. lead: never invoiced and no agreement, in Fortnox or only in Aira. Null for a party that is only a supplier. Read from the invoicing and the agreements, so a change of status alone does not move `updated_at`."},"roles":{"type":"array","items":{"type":"string","enum":["customer","supplier"]},"description":"What the party is in Fortnox. Empty for a lead only in Aira."},"organization_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"identifiers":{"type":"array","items":{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},"description":"Org nr, VAT number, personnummer and any other `(scheme, value)` the party holds."},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"addresses":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["postal","delivery","visiting"],"description":"postal (invoice), delivery or visiting."},"lines":{"type":"array","items":{"type":"string"}},"zip_code":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"anyOf":[{"type":"string"},{"type":"null"}]},"country_code":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO 3166-1 alpha-2."},"country_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"recipient_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["kind","lines","zip_code","city","country_code","country_name","recipient_name","phone"],"additionalProperties":false}},"owner":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"The member linked to the party’s Kundansvarig, who gets what a program writes on it without naming anyone. Null when it belongs to the whole team, or its säljare is linked to no member."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$","description":"When its details last changed, to the microsecond. What `changed_since` reads."}},"required":["id","kind","name","status","roles","organization_number","identifiers","email","phone","addresses","owner","created_at","updated_at"],"additionalProperties":false}}}},"201":{"description":"Created.","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"kind":{"anyOf":[{"type":"string","enum":["company","person"]},{"type":"null"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"anyOf":[{"type":"string","enum":["customer","lost_customer","lead"]},{"type":"null"}],"description":"customer (Kund): from its first invoice, a one-off purchase too, until its last purchase is both more than 2 of its rhythms ago and at least 3 months ago, so it has gone more than twice as long as it usually does without buying. The rhythm is its own köpmönster or, when slower, the rhythm the company’s customers keep for the articles on that purchase. A last purchase 2 or more times its usual size moves that line to 2 times its size in rhythms (three times the usual: 6 rhythms). An agreement in återkommande fakturering in force (running or paused, not past its end date) keeps a customer a Kund however long since it bought; an ended last agreement with no purchase after it makes a Tappad kund. Without a köpmönster of its own, a one-off buyer too, a customer is measured by the rhythm the company’s customers keep for the articles it bought; without one, by the company’s usual rhythm, never faster than every 3 months (so a Tappad kund after at least 6 months); and only without either, by 12 months since its last purchase. lost_customer (Tappad kund): past that line: it bought before, or held an agreement that ended. lead: never invoiced and no agreement, in Fortnox or only in Aira. Null for a party that is only a supplier. Read from the invoicing and the agreements, so a change of status alone does not move `updated_at`."},"roles":{"type":"array","items":{"type":"string","enum":["customer","supplier"]},"description":"What the party is in Fortnox. Empty for a lead only in Aira."},"organization_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"identifiers":{"type":"array","items":{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},"description":"Org nr, VAT number, personnummer and any other `(scheme, value)` the party holds."},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"addresses":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["postal","delivery","visiting"],"description":"postal (invoice), delivery or visiting."},"lines":{"type":"array","items":{"type":"string"}},"zip_code":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"anyOf":[{"type":"string"},{"type":"null"}]},"country_code":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO 3166-1 alpha-2."},"country_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"recipient_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["kind","lines","zip_code","city","country_code","country_name","recipient_name","phone"],"additionalProperties":false}},"owner":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"The member linked to the party’s Kundansvarig, who gets what a program writes on it without naming anyone. Null when it belongs to the whole team, or its säljare is linked to no member."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$","description":"When its details last changed, to the microsecond. What `changed_since` reads."}},"required":["id","kind","name","status","roles","organization_number","identifiers","email","phone","addresses","owner","created_at","updated_at"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The write conflicts with what the book holds; `error.code` says how.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The `Idempotency-Key` was already used for a different request, or Fortnox refused the document; `error.code` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"A service the write needs did not answer, writes to Fortnox are paused, or the service connection needs re-consent; `error.code` says which. See `Retry-After`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/parties/{id}":{"get":{"operationId":"getParty","summary":"Read a party","description":"One party by id, as the list has it.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"kind":{"anyOf":[{"type":"string","enum":["company","person"]},{"type":"null"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"anyOf":[{"type":"string","enum":["customer","lost_customer","lead"]},{"type":"null"}],"description":"customer (Kund): from its first invoice, a one-off purchase too, until its last purchase is both more than 2 of its rhythms ago and at least 3 months ago, so it has gone more than twice as long as it usually does without buying. The rhythm is its own köpmönster or, when slower, the rhythm the company’s customers keep for the articles on that purchase. A last purchase 2 or more times its usual size moves that line to 2 times its size in rhythms (three times the usual: 6 rhythms). An agreement in återkommande fakturering in force (running or paused, not past its end date) keeps a customer a Kund however long since it bought; an ended last agreement with no purchase after it makes a Tappad kund. Without a köpmönster of its own, a one-off buyer too, a customer is measured by the rhythm the company’s customers keep for the articles it bought; without one, by the company’s usual rhythm, never faster than every 3 months (so a Tappad kund after at least 6 months); and only without either, by 12 months since its last purchase. lost_customer (Tappad kund): past that line: it bought before, or held an agreement that ended. lead: never invoiced and no agreement, in Fortnox or only in Aira. Null for a party that is only a supplier. Read from the invoicing and the agreements, so a change of status alone does not move `updated_at`."},"roles":{"type":"array","items":{"type":"string","enum":["customer","supplier"]},"description":"What the party is in Fortnox. Empty for a lead only in Aira."},"organization_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"identifiers":{"type":"array","items":{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},"description":"Org nr, VAT number, personnummer and any other `(scheme, value)` the party holds."},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"addresses":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["postal","delivery","visiting"],"description":"postal (invoice), delivery or visiting."},"lines":{"type":"array","items":{"type":"string"}},"zip_code":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"anyOf":[{"type":"string"},{"type":"null"}]},"country_code":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO 3166-1 alpha-2."},"country_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"recipient_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["kind","lines","zip_code","city","country_code","country_name","recipient_name","phone"],"additionalProperties":false}},"owner":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"The member linked to the party’s Kundansvarig, who gets what a program writes on it without naming anyone. Null when it belongs to the whole team, or its säljare is linked to no member."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$","description":"When its details last changed, to the microsecond. What `changed_since` reads."}},"required":["id","kind","name","status","roles","organization_number","identifiers","email","phone","addresses","owner","created_at","updated_at"],"additionalProperties":false}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"editParty","summary":"Edit a lead","description":"Changes what is sent of a lead’s details and leaves the rest. A party in Fortnox is refused with `party_in_books`: Fortnox is the only home of its details.\n\nScope: `write_aira`.","security":[{"apiKey":["write_aira"]}],"x-scope":"write_aira","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, up to 255 characters. The same key sent again with the same request within a day replays the first success, with `Idempotent-Replayed: true`, instead of writing twice; a refused call keeps nothing, so a corrected one may reuse its key. Sent with a different request after a success it is refused (422).","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":500},"organization_number":{"description":"Null removes it.","anyOf":[{"type":"string","maxLength":40},{"type":"null"}]},"email":{"anyOf":[{"type":"string","maxLength":320,"format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]},"addresses":{"description":"Replaces every address the lead has.","maxItems":3,"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["postal","visiting","delivery"],"description":"postal (invoice), delivery or visiting."},"lines":{"default":[],"maxItems":3,"type":"array","items":{"type":"string","maxLength":500}},"zip_code":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]},"city":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]},"country_code":{"description":"ISO 3166-1 alpha-2.","anyOf":[{"type":"string","minLength":2,"maxLength":2},{"type":"null"}]},"country_name":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]},"recipient_name":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]},"phone":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}]}},"required":["kind"]}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"kind":{"anyOf":[{"type":"string","enum":["company","person"]},{"type":"null"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"anyOf":[{"type":"string","enum":["customer","lost_customer","lead"]},{"type":"null"}],"description":"customer (Kund): from its first invoice, a one-off purchase too, until its last purchase is both more than 2 of its rhythms ago and at least 3 months ago, so it has gone more than twice as long as it usually does without buying. The rhythm is its own köpmönster or, when slower, the rhythm the company’s customers keep for the articles on that purchase. A last purchase 2 or more times its usual size moves that line to 2 times its size in rhythms (three times the usual: 6 rhythms). An agreement in återkommande fakturering in force (running or paused, not past its end date) keeps a customer a Kund however long since it bought; an ended last agreement with no purchase after it makes a Tappad kund. Without a köpmönster of its own, a one-off buyer too, a customer is measured by the rhythm the company’s customers keep for the articles it bought; without one, by the company’s usual rhythm, never faster than every 3 months (so a Tappad kund after at least 6 months); and only without either, by 12 months since its last purchase. lost_customer (Tappad kund): past that line: it bought before, or held an agreement that ended. lead: never invoiced and no agreement, in Fortnox or only in Aira. Null for a party that is only a supplier. Read from the invoicing and the agreements, so a change of status alone does not move `updated_at`."},"roles":{"type":"array","items":{"type":"string","enum":["customer","supplier"]},"description":"What the party is in Fortnox. Empty for a lead only in Aira."},"organization_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"identifiers":{"type":"array","items":{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},"description":"Org nr, VAT number, personnummer and any other `(scheme, value)` the party holds."},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"addresses":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["postal","delivery","visiting"],"description":"postal (invoice), delivery or visiting."},"lines":{"type":"array","items":{"type":"string"}},"zip_code":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"anyOf":[{"type":"string"},{"type":"null"}]},"country_code":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO 3166-1 alpha-2."},"country_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"recipient_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["kind","lines","zip_code","city","country_code","country_name","recipient_name","phone"],"additionalProperties":false}},"owner":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"The member linked to the party’s Kundansvarig, who gets what a program writes on it without naming anyone. Null when it belongs to the whole team, or its säljare is linked to no member."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$","description":"When its details last changed, to the microsecond. What `changed_since` reads."}},"required":["id","kind","name","status","roles","organization_number","identifiers","email","phone","addresses","owner","created_at","updated_at"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The write conflicts with what the book holds; `error.code` says how.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The `Idempotency-Key` was already used for a different request, or Fortnox refused the document; `error.code` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/contacts":{"get":{"operationId":"listContacts","summary":"List contacts","description":"The people on the book’s parties, oldest change first. Page with `next_cursor`; a sync passes the last time it ran as `changed_since`. With `scheme` and `value`, the contact holding that `external_id`.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"changed_since","in":"query","required":false,"description":"Only records that changed at or after this time (ISO 8601). Removals are not listed.","schema":{"description":"Only records that changed at or after this time (ISO 8601). Removals are not listed.","type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"cursor","in":"query","required":false,"description":"The `next_cursor` of the previous page. Leave it out for the first page.","schema":{"description":"The `next_cursor` of the previous page. Leave it out for the first page.","type":"string","maxLength":200}},{"name":"limit","in":"query","required":false,"description":"Records per page, 1 to 500.","schema":{"default":100,"description":"Records per page, 1 to 500.","type":"integer","minimum":1,"maximum":500}},{"name":"scheme","in":"query","required":false,"description":"With `value`: only the record holding this `external_id`.","schema":{"description":"With `value`: only the record holding this `external_id`.","type":"string","maxLength":40}},{"name":"value","in":"query","required":false,"description":"With `scheme`: the `external_id`’s value.","schema":{"description":"With `scheme`: the `external_id`’s value.","type":"string","maxLength":200}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"party_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","description":"The party it belongs to, as `/parties/{id}` reads it."},"name":{"type":"string"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Role or title, free text."},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"linkedin":{"anyOf":[{"type":"string"},{"type":"null"}]},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the contact was given, if any."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$","description":"When it last changed, to the microsecond. What `changed_since` reads."}},"required":["id","party_id","name","title","email","phone","linkedin","external_id","created_at","updated_at"],"additionalProperties":false}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next_cursor"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createContact","summary":"Add a contact","description":"A person at a company in the book, as Lägg till kontakt adds one on its card. An `external_id` another contact holds is refused with `identifier_conflict`.\n\nScope: `write_aira`.","security":[{"apiKey":["write_aira"]}],"x-scope":"write_aira","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, up to 255 characters. The same key sent again with the same request within a day replays the first success, with `Idempotent-Replayed: true`, instead of writing twice; a refused call keeps nothing, so a corrected one may reuse its key. Sent with a different request after a success it is refused (422).","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"party_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","description":"The party it is a contact at: a company, not a person."},"name":{"type":"string","maxLength":200},"title":{"description":"Role or title, free text.","anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"email":{"anyOf":[{"type":"string","maxLength":320},{"type":"null"}]},"phone":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}]},"linkedin":{"description":"A linkedin.com link.","anyOf":[{"type":"string","maxLength":300},{"type":"null"}]},"external_id":{"type":"object","properties":{"scheme":{"type":"string","pattern":"^[a-z][a-z0-9_.-]{0,39}$","description":"Your system’s name, lowercase, e.g. `aira` or `hubspot`."},"value":{"type":"string","minLength":1,"maxLength":200,"description":"The contact’s id in your system."}},"required":["scheme","value"],"description":"An id of your own system, stored on the contact: list `?scheme=&value=` to find the same contact."}},"required":["party_id","name"]}}}},"responses":{"200":{"description":"OK: the record was already in the book, and this is it.","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"party_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","description":"The party it belongs to, as `/parties/{id}` reads it."},"name":{"type":"string"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Role or title, free text."},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"linkedin":{"anyOf":[{"type":"string"},{"type":"null"}]},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the contact was given, if any."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$","description":"When it last changed, to the microsecond. What `changed_since` reads."}},"required":["id","party_id","name","title","email","phone","linkedin","external_id","created_at","updated_at"],"additionalProperties":false}}}},"201":{"description":"Created.","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"party_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","description":"The party it belongs to, as `/parties/{id}` reads it."},"name":{"type":"string"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Role or title, free text."},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"linkedin":{"anyOf":[{"type":"string"},{"type":"null"}]},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the contact was given, if any."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$","description":"When it last changed, to the microsecond. What `changed_since` reads."}},"required":["id","party_id","name","title","email","phone","linkedin","external_id","created_at","updated_at"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The write conflicts with what the book holds; `error.code` says how.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The `Idempotency-Key` was already used for a different request, or Fortnox refused the document; `error.code` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/contacts/{id}":{"get":{"operationId":"getContact","summary":"Read a contact","description":"One contact by id, as the list has it.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"party_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","description":"The party it belongs to, as `/parties/{id}` reads it."},"name":{"type":"string"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Role or title, free text."},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"linkedin":{"anyOf":[{"type":"string"},{"type":"null"}]},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the contact was given, if any."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$","description":"When it last changed, to the microsecond. What `changed_since` reads."}},"required":["id","party_id","name","title","email","phone","linkedin","external_id","created_at","updated_at"],"additionalProperties":false}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"editContact","summary":"Edit a contact","description":"Changes what is sent and leaves the rest; an empty string clears a field. Refused with `not_permitted` where the key’s maker could not change it on screen, and with `identifier_conflict` for an `external_id` another contact holds.\n\nScope: `write_aira`.","security":[{"apiKey":["write_aira"]}],"x-scope":"write_aira","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, up to 255 characters. The same key sent again with the same request within a day replays the first success, with `Idempotent-Replayed: true`, instead of writing twice; a refused call keeps nothing, so a corrected one may reuse its key. Sent with a different request after a success it is refused (422).","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","maxLength":200},"title":{"description":"Role or title, free text.","anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"email":{"anyOf":[{"type":"string","maxLength":320},{"type":"null"}]},"phone":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}]},"linkedin":{"description":"A linkedin.com link.","anyOf":[{"type":"string","maxLength":300},{"type":"null"}]},"external_id":{"description":"Null takes it off.","anyOf":[{"type":"object","properties":{"scheme":{"type":"string","pattern":"^[a-z][a-z0-9_.-]{0,39}$","description":"Your system’s name, lowercase, e.g. `aira` or `hubspot`."},"value":{"type":"string","minLength":1,"maxLength":200,"description":"The contact’s id in your system."}},"required":["scheme","value"],"description":"An id of your own system, stored on the contact: list `?scheme=&value=` to find the same contact."},{"type":"null"}]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"party_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","description":"The party it belongs to, as `/parties/{id}` reads it."},"name":{"type":"string"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Role or title, free text."},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"linkedin":{"anyOf":[{"type":"string"},{"type":"null"}]},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the contact was given, if any."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$","description":"When it last changed, to the microsecond. What `changed_since` reads."}},"required":["id","party_id","name","title","email","phone","linkedin","external_id","created_at","updated_at"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The write conflicts with what the book holds; `error.code` says how.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The `Idempotency-Key` was already used for a different request, or Fortnox refused the document; `error.code` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"removeContact","summary":"Remove a contact","description":"Removes the contact as Ta bort does on its card: it is gone from every read, and mail from its address is not linked to it again. Refused with `not_permitted` where the key’s maker could not remove it on screen.\n\nScope: `write_aira`.","security":[{"apiKey":["write_aira"]}],"x-scope":"write_aira","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, up to 255 characters. The same key sent again with the same request within a day replays the first success, with `Idempotent-Replayed: true`, instead of writing twice; a refused call keeps nothing, so a corrected one may reuse its key. Sent with a different request after a success it is refused (422).","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"removed":{"type":"boolean","const":true}},"required":["id","removed"],"additionalProperties":false}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The `Idempotency-Key` was already used for a different request, or Fortnox refused the document; `error.code` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/stages":{"get":{"operationId":"listStages","summary":"List the pipeline’s stages","description":"The stages of the Affärer board, in its order. Not paged: a pipeline holds a handful.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"include_removed","in":"query","required":false,"description":"`true` lists the removed stages too, after the live ones.","schema":{"default":"false","description":"`true` lists the removed stages too, after the live ones.","type":"string","enum":["true","false"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","description":"What a deal’s `stage_id` takes."},"name":{"type":"string"},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Sorts the live stages as the board does. Not contiguous."},"probability":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Sannolikhet in percent, which an open deal in the stage takes unless it overrides it."},"quote_stage":{"type":"boolean","description":"The stage a deal moves to when its offer is sent. At most one, never a removed one."},"removed":{"type":"boolean","description":"Listed only with `include_removed=true`."}},"required":["id","name","position","probability","quote_stage","removed"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/deals":{"get":{"operationId":"listDeals","summary":"List deals","description":"Every deal in the book, open, won and lost, oldest change first. Removed deals are not listed. With `scheme` and `value`, the deal holding that `external_id`.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"changed_since","in":"query","required":false,"description":"Only records that changed at or after this time (ISO 8601). Removals are not listed.","schema":{"description":"Only records that changed at or after this time (ISO 8601). Removals are not listed.","type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"cursor","in":"query","required":false,"description":"The `next_cursor` of the previous page. Leave it out for the first page.","schema":{"description":"The `next_cursor` of the previous page. Leave it out for the first page.","type":"string","maxLength":200}},{"name":"limit","in":"query","required":false,"description":"Records per page, 1 to 500.","schema":{"default":100,"description":"Records per page, 1 to 500.","type":"integer","minimum":1,"maximum":500}},{"name":"party_id","in":"query","required":false,"description":"Only the deals on this party.","schema":{"description":"Only the deals on this party.","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"scheme","in":"query","required":false,"description":"With `value`: only the record holding this `external_id`.","schema":{"description":"With `value`: only the record holding this `external_id`.","type":"string","maxLength":40}},{"name":"value","in":"query","required":false,"description":"With `scheme`: the `external_id`’s value.","schema":{"description":"With `scheme`: the `external_id`’s value.","type":"string","maxLength":200}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"},"party":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"contact":{"anyOf":[{"type":"object","properties":{"id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"Null for a name typed before contacts were picked."},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"stage":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"probability":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Win probability in percent: the deal’s own, else its stage’s."},"owner":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null for a deal imported from Fortnox that nobody owns."},"close_date":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"status":{"type":"string","enum":["open","won","lost"]},"closed_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"When it was won or lost; null while open."},"lost_reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"lost_reason_text":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The reason in the seller’s words, for `other`."},"competitor_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"won_document":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["order","invoice"]},"number":{"type":"string"}},"required":["type","number"],"additionalProperties":false},{"type":"null"}],"description":"The Fortnox order or invoice the deal was won with."},"currency":{"type":"string","description":"ISO 4217. Every amount on the deal is in it, excluding VAT."},"value":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The value a seller gave the deal; null for none."},"rows_total":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The rows summed, rows per period over twelve months of its schedule, with freight and invoicing fee; null without rows."},"rows":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"article_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per unit, excluding VAT."},"per_period":{"type":"boolean","description":"Billed every period of the deal’s schedule."}},"required":["id","article_number","description","quantity","price","per_period"],"additionalProperties":false}},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the deal was given, if any."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","title","party","contact","stage","probability","owner","close_date","status","closed_at","lost_reason","lost_reason_text","competitor_name","won_document","currency","value","rows_total","rows","external_id","created_at","updated_at"],"additionalProperties":false}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next_cursor"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createDeal","summary":"Create a deal","description":"A deal on a party, as Ny affärsmöjlighet makes one, with its value or rows. Created by the key’s maker, and held by `owner_id` or else the party’s Kundansvarig, never by the maker for being the maker. An `external_id` another deal holds is refused with `identifier_conflict`.\n\nScope: `write_aira`.","security":[{"apiKey":["write_aira"]}],"x-scope":"write_aira","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, up to 255 characters. The same key sent again with the same request within a day replays the first success, with `Idempotent-Replayed: true`, instead of writing twice; a refused call keeps nothing, so a corrected one may reuse its key. Sent with a different request after a success it is refused (422).","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"party_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","description":"The party the deal is with."},"title":{"description":"Defaults to “Affär med <party>”, as on screen.","type":"string","minLength":1,"maxLength":200},"stage_id":{"description":"A stage of the pipeline; the first when left out.","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"owner_id":{"description":"Any member of the company, by their user id, who is told. Left out, the member linked to the party’s Kundansvarig; when the party has none, or its säljare is linked to no member, the deal has no owner and belongs to the whole team until the party gets a Kundansvarig.","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"value":{"description":"The deal’s value, excluding VAT.","anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"close_date":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"contact_id":{"description":"A contact at the party.","anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"rows":{"description":"Product rows, in order.","maxItems":50,"type":"array","items":{"type":"object","properties":{"article_number":{"description":"An article in the books, by its number; or give `description` instead.","type":"string","minLength":1},"description":{"description":"A free row with no article.","type":"string","minLength":1,"maxLength":500},"quantity":{"description":"Defaults to 1.","type":"number","exclusiveMinimum":0},"price":{"description":"Per unit, excluding VAT, in the deal’s currency. Left out, an article row takes its price from the deal’s price list and a free row 0.","type":"number","minimum":0},"per_period":{"description":"Billed every period of the deal’s schedule. Only where the company sells subscriptions in Aira.","type":"boolean"}}}},"external_id":{"type":"object","properties":{"scheme":{"type":"string","pattern":"^[a-z][a-z0-9_.-]{0,39}$","description":"Your system’s name, lowercase, e.g. `aira` or `hubspot`."},"value":{"type":"string","minLength":1,"maxLength":200,"description":"The deal’s id in your system."}},"required":["scheme","value"],"description":"An id of your own system, stored on the deal: list `?scheme=&value=` to find the same deal."}},"required":["party_id"]}}}},"responses":{"200":{"description":"OK: the record was already in the book, and this is it.","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"},"party":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"contact":{"anyOf":[{"type":"object","properties":{"id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"Null for a name typed before contacts were picked."},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"stage":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"probability":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Win probability in percent: the deal’s own, else its stage’s."},"owner":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null for a deal imported from Fortnox that nobody owns."},"close_date":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"status":{"type":"string","enum":["open","won","lost"]},"closed_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"When it was won or lost; null while open."},"lost_reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"lost_reason_text":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The reason in the seller’s words, for `other`."},"competitor_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"won_document":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["order","invoice"]},"number":{"type":"string"}},"required":["type","number"],"additionalProperties":false},{"type":"null"}],"description":"The Fortnox order or invoice the deal was won with."},"currency":{"type":"string","description":"ISO 4217. Every amount on the deal is in it, excluding VAT."},"value":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The value a seller gave the deal; null for none."},"rows_total":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The rows summed, rows per period over twelve months of its schedule, with freight and invoicing fee; null without rows."},"rows":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"article_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per unit, excluding VAT."},"per_period":{"type":"boolean","description":"Billed every period of the deal’s schedule."}},"required":["id","article_number","description","quantity","price","per_period"],"additionalProperties":false}},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the deal was given, if any."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","title","party","contact","stage","probability","owner","close_date","status","closed_at","lost_reason","lost_reason_text","competitor_name","won_document","currency","value","rows_total","rows","external_id","created_at","updated_at"],"additionalProperties":false}}}},"201":{"description":"Created.","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"},"party":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"contact":{"anyOf":[{"type":"object","properties":{"id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"Null for a name typed before contacts were picked."},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"stage":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"probability":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Win probability in percent: the deal’s own, else its stage’s."},"owner":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null for a deal imported from Fortnox that nobody owns."},"close_date":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"status":{"type":"string","enum":["open","won","lost"]},"closed_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"When it was won or lost; null while open."},"lost_reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"lost_reason_text":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The reason in the seller’s words, for `other`."},"competitor_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"won_document":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["order","invoice"]},"number":{"type":"string"}},"required":["type","number"],"additionalProperties":false},{"type":"null"}],"description":"The Fortnox order or invoice the deal was won with."},"currency":{"type":"string","description":"ISO 4217. Every amount on the deal is in it, excluding VAT."},"value":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The value a seller gave the deal; null for none."},"rows_total":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The rows summed, rows per period over twelve months of its schedule, with freight and invoicing fee; null without rows."},"rows":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"article_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per unit, excluding VAT."},"per_period":{"type":"boolean","description":"Billed every period of the deal’s schedule."}},"required":["id","article_number","description","quantity","price","per_period"],"additionalProperties":false}},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the deal was given, if any."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","title","party","contact","stage","probability","owner","close_date","status","closed_at","lost_reason","lost_reason_text","competitor_name","won_document","currency","value","rows_total","rows","external_id","created_at","updated_at"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The write conflicts with what the book holds; `error.code` says how.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The `Idempotency-Key` was already used for a different request, or Fortnox refused the document; `error.code` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/deals/{id}":{"get":{"operationId":"getDeal","summary":"Read a deal","description":"One deal with its rows.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"},"party":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"contact":{"anyOf":[{"type":"object","properties":{"id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"Null for a name typed before contacts were picked."},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"stage":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"probability":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Win probability in percent: the deal’s own, else its stage’s."},"owner":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null for a deal imported from Fortnox that nobody owns."},"close_date":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"status":{"type":"string","enum":["open","won","lost"]},"closed_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"When it was won or lost; null while open."},"lost_reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"lost_reason_text":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The reason in the seller’s words, for `other`."},"competitor_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"won_document":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["order","invoice"]},"number":{"type":"string"}},"required":["type","number"],"additionalProperties":false},{"type":"null"}],"description":"The Fortnox order or invoice the deal was won with."},"currency":{"type":"string","description":"ISO 4217. Every amount on the deal is in it, excluding VAT."},"value":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The value a seller gave the deal; null for none."},"rows_total":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The rows summed, rows per period over twelve months of its schedule, with freight and invoicing fee; null without rows."},"rows":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"article_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per unit, excluding VAT."},"per_period":{"type":"boolean","description":"Billed every period of the deal’s schedule."}},"required":["id","article_number","description","quantity","price","per_period"],"additionalProperties":false}},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the deal was given, if any."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","title","party","contact","stage","probability","owner","close_date","status","closed_at","lost_reason","lost_reason_text","competitor_name","won_document","currency","value","rows_total","rows","external_id","created_at","updated_at"],"additionalProperties":false}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"editDeal","summary":"Edit a deal","description":"Changes what is sent and leaves the rest. A won or lost deal is locked (`deal_closed`), but for its `external_id`; win or lose one with `POST /deals/{id}/outcome`. Refused with `not_permitted` where the key’s maker could not change it on screen, and with `identifier_conflict` for an `external_id` another deal holds.\n\nScope: `write_aira`.","security":[{"apiKey":["write_aira"]}],"x-scope":"write_aira","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, up to 255 characters. The same key sent again with the same request within a day replays the first success, with `Idempotent-Replayed: true`, instead of writing twice; a refused call keeps nothing, so a corrected one may reuse its key. Sent with a different request after a success it is refused (422).","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"stage_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"owner_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"value":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"close_date":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"contact_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"external_id":{"description":"Null takes it off.","anyOf":[{"type":"object","properties":{"scheme":{"type":"string","pattern":"^[a-z][a-z0-9_.-]{0,39}$","description":"Your system’s name, lowercase, e.g. `aira` or `hubspot`."},"value":{"type":"string","minLength":1,"maxLength":200,"description":"The deal’s id in your system."}},"required":["scheme","value"],"description":"An id of your own system, stored on the deal: list `?scheme=&value=` to find the same deal."},{"type":"null"}]}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"},"party":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"contact":{"anyOf":[{"type":"object","properties":{"id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"Null for a name typed before contacts were picked."},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"stage":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"probability":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Win probability in percent: the deal’s own, else its stage’s."},"owner":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null for a deal imported from Fortnox that nobody owns."},"close_date":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"status":{"type":"string","enum":["open","won","lost"]},"closed_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"When it was won or lost; null while open."},"lost_reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"lost_reason_text":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The reason in the seller’s words, for `other`."},"competitor_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"won_document":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["order","invoice"]},"number":{"type":"string"}},"required":["type","number"],"additionalProperties":false},{"type":"null"}],"description":"The Fortnox order or invoice the deal was won with."},"currency":{"type":"string","description":"ISO 4217. Every amount on the deal is in it, excluding VAT."},"value":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The value a seller gave the deal; null for none."},"rows_total":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The rows summed, rows per period over twelve months of its schedule, with freight and invoicing fee; null without rows."},"rows":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"article_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per unit, excluding VAT."},"per_period":{"type":"boolean","description":"Billed every period of the deal’s schedule."}},"required":["id","article_number","description","quantity","price","per_period"],"additionalProperties":false}},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the deal was given, if any."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","title","party","contact","stage","probability","owner","close_date","status","closed_at","lost_reason","lost_reason_text","competitor_name","won_document","currency","value","rows_total","rows","external_id","created_at","updated_at"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The write conflicts with what the book holds; `error.code` says how.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The `Idempotency-Key` was already used for a different request, or Fortnox refused the document; `error.code` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"removeDeal","summary":"Remove a deal","description":"Removes a deal that should never have been, as Ta bort affärsmöjlighet does: it is not counted as lost and is gone from every read. Refused with `deal_not_removable` for a deal won with a Fortnox document or agreement, or following a quote that stands.\n\nScope: `write_aira`.","security":[{"apiKey":["write_aira"]}],"x-scope":"write_aira","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, up to 255 characters. The same key sent again with the same request within a day replays the first success, with `Idempotent-Replayed: true`, instead of writing twice; a refused call keeps nothing, so a corrected one may reuse its key. Sent with a different request after a success it is refused (422).","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"removed":{"type":"boolean","const":true}},"required":["id","removed"],"additionalProperties":false}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The write conflicts with what the book holds; `error.code` says how.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The `Idempotency-Key` was already used for a different request, or Fortnox refused the document; `error.code` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/deals/{id}/outcome":{"post":{"operationId":"setDealOutcome","summary":"Mark a deal lost","description":"Marks an open deal lost, with an optional reason, as Förlorad does. `won` is refused with `win_through_graduation`: a deal is won by graduating it into a Fortnox order or invoice.\n\nScope: `write_aira`.","security":[{"apiKey":["write_aira"]}],"x-scope":"write_aira","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, up to 255 characters. The same key sent again with the same request within a day replays the first success, with `Idempotent-Replayed: true`, instead of writing twice; a refused call keeps nothing, so a corrected one may reuse its key. Sent with a different request after a success it is refused (422).","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"status":{"type":"string","enum":["won","lost"],"description":"Only `lost`: a deal is won by graduating it into Fortnox."},"lost_reason":{"anyOf":[{"type":"string","enum":["competitor","price","timing","needs_other","unresponsive","other"]},{"type":"null"}]},"lost_reason_text":{"description":"The reason in your own words; kept only with `other`.","anyOf":[{"type":"string","maxLength":500},{"type":"null"}]}},"required":["status"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"},"party":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"contact":{"anyOf":[{"type":"object","properties":{"id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"Null for a name typed before contacts were picked."},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"stage":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"probability":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Win probability in percent: the deal’s own, else its stage’s."},"owner":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null for a deal imported from Fortnox that nobody owns."},"close_date":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"status":{"type":"string","enum":["open","won","lost"]},"closed_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"When it was won or lost; null while open."},"lost_reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"lost_reason_text":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The reason in the seller’s words, for `other`."},"competitor_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"won_document":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["order","invoice"]},"number":{"type":"string"}},"required":["type","number"],"additionalProperties":false},{"type":"null"}],"description":"The Fortnox order or invoice the deal was won with."},"currency":{"type":"string","description":"ISO 4217. Every amount on the deal is in it, excluding VAT."},"value":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The value a seller gave the deal; null for none."},"rows_total":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The rows summed, rows per period over twelve months of its schedule, with freight and invoicing fee; null without rows."},"rows":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"article_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per unit, excluding VAT."},"per_period":{"type":"boolean","description":"Billed every period of the deal’s schedule."}},"required":["id","article_number","description","quantity","price","per_period"],"additionalProperties":false}},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the deal was given, if any."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","title","party","contact","stage","probability","owner","close_date","status","closed_at","lost_reason","lost_reason_text","competitor_name","won_document","currency","value","rows_total","rows","external_id","created_at","updated_at"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The write conflicts with what the book holds; `error.code` says how.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The `Idempotency-Key` was already used for a different request, or Fortnox refused the document; `error.code` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/deals/{id}/rows":{"post":{"operationId":"addDealRow","summary":"Add a row to a deal","description":"An article row or a free row, last on the deal. Answers the deal.\n\nScope: `write_aira`.","security":[{"apiKey":["write_aira"]}],"x-scope":"write_aira","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, up to 255 characters. The same key sent again with the same request within a day replays the first success, with `Idempotent-Replayed: true`, instead of writing twice; a refused call keeps nothing, so a corrected one may reuse its key. Sent with a different request after a success it is refused (422).","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"article_number":{"description":"An article in the books, by its number; or give `description` instead.","type":"string","minLength":1},"description":{"description":"A free row with no article.","type":"string","minLength":1,"maxLength":500},"quantity":{"description":"Defaults to 1.","type":"number","exclusiveMinimum":0},"price":{"description":"Per unit, excluding VAT, in the deal’s currency. Left out, an article row takes its price from the deal’s price list and a free row 0.","type":"number","minimum":0},"per_period":{"description":"Billed every period of the deal’s schedule. Only where the company sells subscriptions in Aira.","type":"boolean"}}}}}},"responses":{"200":{"description":"OK: the record was already in the book, and this is it.","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"},"party":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"contact":{"anyOf":[{"type":"object","properties":{"id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"Null for a name typed before contacts were picked."},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"stage":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"probability":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Win probability in percent: the deal’s own, else its stage’s."},"owner":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null for a deal imported from Fortnox that nobody owns."},"close_date":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"status":{"type":"string","enum":["open","won","lost"]},"closed_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"When it was won or lost; null while open."},"lost_reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"lost_reason_text":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The reason in the seller’s words, for `other`."},"competitor_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"won_document":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["order","invoice"]},"number":{"type":"string"}},"required":["type","number"],"additionalProperties":false},{"type":"null"}],"description":"The Fortnox order or invoice the deal was won with."},"currency":{"type":"string","description":"ISO 4217. Every amount on the deal is in it, excluding VAT."},"value":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The value a seller gave the deal; null for none."},"rows_total":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The rows summed, rows per period over twelve months of its schedule, with freight and invoicing fee; null without rows."},"rows":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"article_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per unit, excluding VAT."},"per_period":{"type":"boolean","description":"Billed every period of the deal’s schedule."}},"required":["id","article_number","description","quantity","price","per_period"],"additionalProperties":false}},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the deal was given, if any."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","title","party","contact","stage","probability","owner","close_date","status","closed_at","lost_reason","lost_reason_text","competitor_name","won_document","currency","value","rows_total","rows","external_id","created_at","updated_at"],"additionalProperties":false}}}},"201":{"description":"Created.","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"},"party":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"contact":{"anyOf":[{"type":"object","properties":{"id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"Null for a name typed before contacts were picked."},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"stage":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"probability":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Win probability in percent: the deal’s own, else its stage’s."},"owner":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null for a deal imported from Fortnox that nobody owns."},"close_date":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"status":{"type":"string","enum":["open","won","lost"]},"closed_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"When it was won or lost; null while open."},"lost_reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"lost_reason_text":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The reason in the seller’s words, for `other`."},"competitor_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"won_document":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["order","invoice"]},"number":{"type":"string"}},"required":["type","number"],"additionalProperties":false},{"type":"null"}],"description":"The Fortnox order or invoice the deal was won with."},"currency":{"type":"string","description":"ISO 4217. Every amount on the deal is in it, excluding VAT."},"value":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The value a seller gave the deal; null for none."},"rows_total":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The rows summed, rows per period over twelve months of its schedule, with freight and invoicing fee; null without rows."},"rows":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"article_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per unit, excluding VAT."},"per_period":{"type":"boolean","description":"Billed every period of the deal’s schedule."}},"required":["id","article_number","description","quantity","price","per_period"],"additionalProperties":false}},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the deal was given, if any."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","title","party","contact","stage","probability","owner","close_date","status","closed_at","lost_reason","lost_reason_text","competitor_name","won_document","currency","value","rows_total","rows","external_id","created_at","updated_at"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The write conflicts with what the book holds; `error.code` says how.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The `Idempotency-Key` was already used for a different request, or Fortnox refused the document; `error.code` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/deals/{id}/rows/{row_id}":{"patch":{"operationId":"editDealRow","summary":"Edit a deal’s row","description":"Its quantity, price or kind. Answers the deal.\n\nScope: `write_aira`.","security":[{"apiKey":["write_aira"]}],"x-scope":"write_aira","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}},{"name":"row_id","in":"path","required":true,"description":"The row’s id.","schema":{"type":"string","description":"The row’s id."}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, up to 255 characters. The same key sent again with the same request within a day replays the first success, with `Idempotent-Replayed: true`, instead of writing twice; a refused call keeps nothing, so a corrected one may reuse its key. Sent with a different request after a success it is refused (422).","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"quantity":{"description":"Defaults to 1.","type":"number","exclusiveMinimum":0},"price":{"description":"Per unit, excluding VAT, in the deal’s currency. Left out, an article row takes its price from the deal’s price list and a free row 0.","type":"number","minimum":0},"per_period":{"description":"Billed every period of the deal’s schedule. Only where the company sells subscriptions in Aira.","type":"boolean"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"},"party":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"contact":{"anyOf":[{"type":"object","properties":{"id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"Null for a name typed before contacts were picked."},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"stage":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"probability":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Win probability in percent: the deal’s own, else its stage’s."},"owner":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null for a deal imported from Fortnox that nobody owns."},"close_date":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"status":{"type":"string","enum":["open","won","lost"]},"closed_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"When it was won or lost; null while open."},"lost_reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"lost_reason_text":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The reason in the seller’s words, for `other`."},"competitor_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"won_document":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["order","invoice"]},"number":{"type":"string"}},"required":["type","number"],"additionalProperties":false},{"type":"null"}],"description":"The Fortnox order or invoice the deal was won with."},"currency":{"type":"string","description":"ISO 4217. Every amount on the deal is in it, excluding VAT."},"value":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The value a seller gave the deal; null for none."},"rows_total":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The rows summed, rows per period over twelve months of its schedule, with freight and invoicing fee; null without rows."},"rows":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"article_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per unit, excluding VAT."},"per_period":{"type":"boolean","description":"Billed every period of the deal’s schedule."}},"required":["id","article_number","description","quantity","price","per_period"],"additionalProperties":false}},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the deal was given, if any."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","title","party","contact","stage","probability","owner","close_date","status","closed_at","lost_reason","lost_reason_text","competitor_name","won_document","currency","value","rows_total","rows","external_id","created_at","updated_at"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The write conflicts with what the book holds; `error.code` says how.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The `Idempotency-Key` was already used for a different request, or Fortnox refused the document; `error.code` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"removeDealRow","summary":"Remove a deal’s row","description":"Answers the deal.\n\nScope: `write_aira`.","security":[{"apiKey":["write_aira"]}],"x-scope":"write_aira","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}},{"name":"row_id","in":"path","required":true,"description":"The row’s id.","schema":{"type":"string","description":"The row’s id."}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, up to 255 characters. The same key sent again with the same request within a day replays the first success, with `Idempotent-Replayed: true`, instead of writing twice; a refused call keeps nothing, so a corrected one may reuse its key. Sent with a different request after a success it is refused (422).","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"},"party":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"contact":{"anyOf":[{"type":"object","properties":{"id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"Null for a name typed before contacts were picked."},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"stage":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"probability":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Win probability in percent: the deal’s own, else its stage’s."},"owner":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null for a deal imported from Fortnox that nobody owns."},"close_date":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"status":{"type":"string","enum":["open","won","lost"]},"closed_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"When it was won or lost; null while open."},"lost_reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"lost_reason_text":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The reason in the seller’s words, for `other`."},"competitor_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"won_document":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["order","invoice"]},"number":{"type":"string"}},"required":["type","number"],"additionalProperties":false},{"type":"null"}],"description":"The Fortnox order or invoice the deal was won with."},"currency":{"type":"string","description":"ISO 4217. Every amount on the deal is in it, excluding VAT."},"value":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The value a seller gave the deal; null for none."},"rows_total":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The rows summed, rows per period over twelve months of its schedule, with freight and invoicing fee; null without rows."},"rows":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"article_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per unit, excluding VAT."},"per_period":{"type":"boolean","description":"Billed every period of the deal’s schedule."}},"required":["id","article_number","description","quantity","price","per_period"],"additionalProperties":false}},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the deal was given, if any."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","title","party","contact","stage","probability","owner","close_date","status","closed_at","lost_reason","lost_reason_text","competitor_name","won_document","currency","value","rows_total","rows","external_id","created_at","updated_at"],"additionalProperties":false}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The write conflicts with what the book holds; `error.code` says how.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The `Idempotency-Key` was already used for a different request, or Fortnox refused the document; `error.code` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/deals/{id}/graduations":{"post":{"operationId":"graduateDeal","summary":"Graduate a deal into Fortnox","description":"Writes the deal into Fortnox as a quote, order or invoice, built from the deal as it stands: its party, rows, price list and currency. Only header fields are yours. An order or invoice wins the deal; for a lead it adds the customer to Fortnox first. Answers 201 once Fortnox gave the document its number, and 202 `pending` when Fortnox’s answer was lost (a 202 is never kept for an `Idempotency-Key`). Refused with `already_graduated` for a deal that has its order or invoice, and with `graduation_unconfirmed` while an earlier graduation of the deal is pending. A paused write or a service connection needing re-consent answers 503 with `Retry-After`, and nothing was sent.\n\nScope: `write_fortnox`.","security":[{"apiKey":["write_fortnox"]}],"x-scope":"write_fortnox","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, up to 255 characters. The same key sent again with the same request within a day replays the first success, with `Idempotent-Replayed: true`, instead of writing twice; a refused call keeps nothing, so a corrected one may reuse its key. Sent with a different request after a success it is refused (422).","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"document":{"type":"string","enum":["quote","order","invoice"],"description":"`order` or `invoice` wins the deal, adding a lead to Fortnox as a customer first. `quote` leaves it open, following the quote."},"header":{"description":"The document’s header. Its rows are always the deal’s: change the deal first.","type":"object","properties":{"our_reference":{"description":"Vår referens: a säljare’s name as the company’s Fortnox has it. The deal owner’s when left out.","type":"string","minLength":1,"maxLength":50},"your_reference":{"description":"Er referens. The deal’s contact when left out.","type":"string","minLength":1,"maxLength":50},"your_order_number":{"description":"Ert ordernummer.","type":"string","minLength":1,"maxLength":30},"document_date":{"description":"The quote’s, order’s or invoice’s date. Today when left out.","type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"due_date":{"description":"An invoice’s due date. From its terms of payment when left out.","type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"delivery_date":{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"valid_until":{"description":"How long a quote stands.","type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"}},"additionalProperties":false}},"required":["document"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK: the record was already in the book, and this is it.","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"deal_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"document":{"type":"string","enum":["quote","order","invoice"]},"status":{"type":"string","enum":["pending","written"],"description":"`pending`: Fortnox’s answer never arrived, so the document, and for a lead the customer, may or may not exist. Check Fortnox, then confirm it to send it again or drop it; nothing is sent until you confirm."},"number":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The document’s number in Fortnox, once written."},"customer":{"anyOf":[{"type":"object","properties":{"number":{"type":"string"},"created":{"type":"boolean","description":"The lead was added to Fortnox as this customer."}},"required":["number","created"],"additionalProperties":false},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"deal":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"},"party":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"contact":{"anyOf":[{"type":"object","properties":{"id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"Null for a name typed before contacts were picked."},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"stage":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"probability":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Win probability in percent: the deal’s own, else its stage’s."},"owner":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null for a deal imported from Fortnox that nobody owns."},"close_date":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"status":{"type":"string","enum":["open","won","lost"]},"closed_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"When it was won or lost; null while open."},"lost_reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"lost_reason_text":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The reason in the seller’s words, for `other`."},"competitor_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"won_document":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["order","invoice"]},"number":{"type":"string"}},"required":["type","number"],"additionalProperties":false},{"type":"null"}],"description":"The Fortnox order or invoice the deal was won with."},"currency":{"type":"string","description":"ISO 4217. Every amount on the deal is in it, excluding VAT."},"value":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The value a seller gave the deal; null for none."},"rows_total":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The rows summed, rows per period over twelve months of its schedule, with freight and invoicing fee; null without rows."},"rows":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"article_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per unit, excluding VAT."},"per_period":{"type":"boolean","description":"Billed every period of the deal’s schedule."}},"required":["id","article_number","description","quantity","price","per_period"],"additionalProperties":false}},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the deal was given, if any."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","title","party","contact","stage","probability","owner","close_date","status","closed_at","lost_reason","lost_reason_text","competitor_name","won_document","currency","value","rows_total","rows","external_id","created_at","updated_at"],"additionalProperties":false}},"required":["id","deal_id","document","status","number","customer","created_at","updated_at","deal"],"additionalProperties":false}}}},"201":{"description":"Created.","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"deal_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"document":{"type":"string","enum":["quote","order","invoice"]},"status":{"type":"string","enum":["pending","written"],"description":"`pending`: Fortnox’s answer never arrived, so the document, and for a lead the customer, may or may not exist. Check Fortnox, then confirm it to send it again or drop it; nothing is sent until you confirm."},"number":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The document’s number in Fortnox, once written."},"customer":{"anyOf":[{"type":"object","properties":{"number":{"type":"string"},"created":{"type":"boolean","description":"The lead was added to Fortnox as this customer."}},"required":["number","created"],"additionalProperties":false},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"deal":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"},"party":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"contact":{"anyOf":[{"type":"object","properties":{"id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"Null for a name typed before contacts were picked."},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"stage":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"probability":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Win probability in percent: the deal’s own, else its stage’s."},"owner":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null for a deal imported from Fortnox that nobody owns."},"close_date":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"status":{"type":"string","enum":["open","won","lost"]},"closed_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"When it was won or lost; null while open."},"lost_reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"lost_reason_text":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The reason in the seller’s words, for `other`."},"competitor_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"won_document":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["order","invoice"]},"number":{"type":"string"}},"required":["type","number"],"additionalProperties":false},{"type":"null"}],"description":"The Fortnox order or invoice the deal was won with."},"currency":{"type":"string","description":"ISO 4217. Every amount on the deal is in it, excluding VAT."},"value":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The value a seller gave the deal; null for none."},"rows_total":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The rows summed, rows per period over twelve months of its schedule, with freight and invoicing fee; null without rows."},"rows":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"article_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per unit, excluding VAT."},"per_period":{"type":"boolean","description":"Billed every period of the deal’s schedule."}},"required":["id","article_number","description","quantity","price","per_period"],"additionalProperties":false}},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the deal was given, if any."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","title","party","contact","stage","probability","owner","close_date","status","closed_at","lost_reason","lost_reason_text","competitor_name","won_document","currency","value","rows_total","rows","external_id","created_at","updated_at"],"additionalProperties":false}},"required":["id","deal_id","document","status","number","customer","created_at","updated_at","deal"],"additionalProperties":false}}}},"202":{"description":"Pending: Fortnox’s answer was lost. Read it, and confirm or drop it once you have checked Fortnox.","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"deal_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"document":{"type":"string","enum":["quote","order","invoice"]},"status":{"type":"string","enum":["pending","written"],"description":"`pending`: Fortnox’s answer never arrived, so the document, and for a lead the customer, may or may not exist. Check Fortnox, then confirm it to send it again or drop it; nothing is sent until you confirm."},"number":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The document’s number in Fortnox, once written."},"customer":{"anyOf":[{"type":"object","properties":{"number":{"type":"string"},"created":{"type":"boolean","description":"The lead was added to Fortnox as this customer."}},"required":["number","created"],"additionalProperties":false},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"deal":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"},"party":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"contact":{"anyOf":[{"type":"object","properties":{"id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"Null for a name typed before contacts were picked."},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"stage":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"probability":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Win probability in percent: the deal’s own, else its stage’s."},"owner":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null for a deal imported from Fortnox that nobody owns."},"close_date":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"status":{"type":"string","enum":["open","won","lost"]},"closed_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"When it was won or lost; null while open."},"lost_reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"lost_reason_text":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The reason in the seller’s words, for `other`."},"competitor_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"won_document":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["order","invoice"]},"number":{"type":"string"}},"required":["type","number"],"additionalProperties":false},{"type":"null"}],"description":"The Fortnox order or invoice the deal was won with."},"currency":{"type":"string","description":"ISO 4217. Every amount on the deal is in it, excluding VAT."},"value":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The value a seller gave the deal; null for none."},"rows_total":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The rows summed, rows per period over twelve months of its schedule, with freight and invoicing fee; null without rows."},"rows":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"article_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per unit, excluding VAT."},"per_period":{"type":"boolean","description":"Billed every period of the deal’s schedule."}},"required":["id","article_number","description","quantity","price","per_period"],"additionalProperties":false}},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the deal was given, if any."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","title","party","contact","stage","probability","owner","close_date","status","closed_at","lost_reason","lost_reason_text","competitor_name","won_document","currency","value","rows_total","rows","external_id","created_at","updated_at"],"additionalProperties":false}},"required":["id","deal_id","document","status","number","customer","created_at","updated_at","deal"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The write conflicts with what the book holds; `error.code` says how.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The `Idempotency-Key` was already used for a different request, or Fortnox refused the document; `error.code` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"A service the write needs did not answer, writes to Fortnox are paused, or the service connection needs re-consent; `error.code` says which. See `Retry-After`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"listGraduations","summary":"List a deal’s graduations","description":"Every graduation of the deal, newest first, written or pending: how a program whose own call timed out finds the graduation it sent. A deal has a handful, so they come in one page and `next_cursor` is always null.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"deal_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"document":{"type":"string","enum":["quote","order","invoice"]},"status":{"type":"string","enum":["pending","written"],"description":"`pending`: Fortnox’s answer never arrived, so the document, and for a lead the customer, may or may not exist. Check Fortnox, then confirm it to send it again or drop it; nothing is sent until you confirm."},"number":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The document’s number in Fortnox, once written."},"customer":{"anyOf":[{"type":"object","properties":{"number":{"type":"string"},"created":{"type":"boolean","description":"The lead was added to Fortnox as this customer."}},"required":["number","created"],"additionalProperties":false},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"deal":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"},"party":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"contact":{"anyOf":[{"type":"object","properties":{"id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"Null for a name typed before contacts were picked."},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"stage":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"probability":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Win probability in percent: the deal’s own, else its stage’s."},"owner":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null for a deal imported from Fortnox that nobody owns."},"close_date":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"status":{"type":"string","enum":["open","won","lost"]},"closed_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"When it was won or lost; null while open."},"lost_reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"lost_reason_text":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The reason in the seller’s words, for `other`."},"competitor_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"won_document":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["order","invoice"]},"number":{"type":"string"}},"required":["type","number"],"additionalProperties":false},{"type":"null"}],"description":"The Fortnox order or invoice the deal was won with."},"currency":{"type":"string","description":"ISO 4217. Every amount on the deal is in it, excluding VAT."},"value":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The value a seller gave the deal; null for none."},"rows_total":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The rows summed, rows per period over twelve months of its schedule, with freight and invoicing fee; null without rows."},"rows":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"article_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per unit, excluding VAT."},"per_period":{"type":"boolean","description":"Billed every period of the deal’s schedule."}},"required":["id","article_number","description","quantity","price","per_period"],"additionalProperties":false}},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the deal was given, if any."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","title","party","contact","stage","probability","owner","close_date","status","closed_at","lost_reason","lost_reason_text","competitor_name","won_document","currency","value","rows_total","rows","external_id","created_at","updated_at"],"additionalProperties":false}},"required":["id","deal_id","document","status","number","customer","created_at","updated_at","deal"],"additionalProperties":false}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next_cursor"],"additionalProperties":false}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/deals/{id}/graduations/{graduation_id}":{"get":{"operationId":"getGraduation","summary":"Read a graduation","description":"Whether a graduation is written or still pending, with the deal as it is now.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}},{"name":"graduation_id","in":"path","required":true,"description":"The graduation’s id.","schema":{"type":"string","description":"The graduation’s id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"deal_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"document":{"type":"string","enum":["quote","order","invoice"]},"status":{"type":"string","enum":["pending","written"],"description":"`pending`: Fortnox’s answer never arrived, so the document, and for a lead the customer, may or may not exist. Check Fortnox, then confirm it to send it again or drop it; nothing is sent until you confirm."},"number":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The document’s number in Fortnox, once written."},"customer":{"anyOf":[{"type":"object","properties":{"number":{"type":"string"},"created":{"type":"boolean","description":"The lead was added to Fortnox as this customer."}},"required":["number","created"],"additionalProperties":false},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"deal":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"},"party":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"contact":{"anyOf":[{"type":"object","properties":{"id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"Null for a name typed before contacts were picked."},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"stage":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"probability":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Win probability in percent: the deal’s own, else its stage’s."},"owner":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null for a deal imported from Fortnox that nobody owns."},"close_date":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"status":{"type":"string","enum":["open","won","lost"]},"closed_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"When it was won or lost; null while open."},"lost_reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"lost_reason_text":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The reason in the seller’s words, for `other`."},"competitor_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"won_document":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["order","invoice"]},"number":{"type":"string"}},"required":["type","number"],"additionalProperties":false},{"type":"null"}],"description":"The Fortnox order or invoice the deal was won with."},"currency":{"type":"string","description":"ISO 4217. Every amount on the deal is in it, excluding VAT."},"value":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The value a seller gave the deal; null for none."},"rows_total":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The rows summed, rows per period over twelve months of its schedule, with freight and invoicing fee; null without rows."},"rows":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"article_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per unit, excluding VAT."},"per_period":{"type":"boolean","description":"Billed every period of the deal’s schedule."}},"required":["id","article_number","description","quantity","price","per_period"],"additionalProperties":false}},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the deal was given, if any."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","title","party","contact","stage","probability","owner","close_date","status","closed_at","lost_reason","lost_reason_text","competitor_name","won_document","currency","value","rows_total","rows","external_id","created_at","updated_at"],"additionalProperties":false}},"required":["id","deal_id","document","status","number","customer","created_at","updated_at","deal"],"additionalProperties":false}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"dropGraduation","summary":"Drop a pending graduation","description":"For a pending graduation whose document you found in Fortnox, or no longer want: nothing is sent, and the deal takes graduations again. A document that did land stays in Fortnox, and the deal stays as it is in Aira. Refused with `graduation_not_pending` for one that is written or being sent.\n\nScope: `write_fortnox`.","security":[{"apiKey":["write_fortnox"]}],"x-scope":"write_fortnox","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}},{"name":"graduation_id","in":"path","required":true,"description":"The graduation’s id.","schema":{"type":"string","description":"The graduation’s id."}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, up to 255 characters. The same key sent again with the same request within a day replays the first success, with `Idempotent-Replayed: true`, instead of writing twice; a refused call keeps nothing, so a corrected one may reuse its key. Sent with a different request after a success it is refused (422).","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"removed":{"type":"boolean","const":true}},"required":["id","removed"],"additionalProperties":false}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The write conflicts with what the book holds; `error.code` says how.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/deals/{id}/graduations/{graduation_id}/confirm":{"post":{"operationId":"confirmGraduation","summary":"Send a pending graduation again","description":"For a pending graduation once you have checked Fortnox has no such document (for a lead, no such customer either): it is built again from the deal as it stands, with the header first sent, and sent once. Confirming twice sends it once. Refused with `graduation_not_pending` for one that is written or being sent.\n\nScope: `write_fortnox`.","security":[{"apiKey":["write_fortnox"]}],"x-scope":"write_fortnox","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}},{"name":"graduation_id","in":"path","required":true,"description":"The graduation’s id.","schema":{"type":"string","description":"The graduation’s id."}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, up to 255 characters. The same key sent again with the same request within a day replays the first success, with `Idempotent-Replayed: true`, instead of writing twice; a refused call keeps nothing, so a corrected one may reuse its key. Sent with a different request after a success it is refused (422).","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"OK: the record was already in the book, and this is it.","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"deal_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"document":{"type":"string","enum":["quote","order","invoice"]},"status":{"type":"string","enum":["pending","written"],"description":"`pending`: Fortnox’s answer never arrived, so the document, and for a lead the customer, may or may not exist. Check Fortnox, then confirm it to send it again or drop it; nothing is sent until you confirm."},"number":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The document’s number in Fortnox, once written."},"customer":{"anyOf":[{"type":"object","properties":{"number":{"type":"string"},"created":{"type":"boolean","description":"The lead was added to Fortnox as this customer."}},"required":["number","created"],"additionalProperties":false},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"deal":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"},"party":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"contact":{"anyOf":[{"type":"object","properties":{"id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"Null for a name typed before contacts were picked."},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"stage":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"probability":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Win probability in percent: the deal’s own, else its stage’s."},"owner":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null for a deal imported from Fortnox that nobody owns."},"close_date":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"status":{"type":"string","enum":["open","won","lost"]},"closed_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"When it was won or lost; null while open."},"lost_reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"lost_reason_text":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The reason in the seller’s words, for `other`."},"competitor_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"won_document":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["order","invoice"]},"number":{"type":"string"}},"required":["type","number"],"additionalProperties":false},{"type":"null"}],"description":"The Fortnox order or invoice the deal was won with."},"currency":{"type":"string","description":"ISO 4217. Every amount on the deal is in it, excluding VAT."},"value":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The value a seller gave the deal; null for none."},"rows_total":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The rows summed, rows per period over twelve months of its schedule, with freight and invoicing fee; null without rows."},"rows":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"article_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per unit, excluding VAT."},"per_period":{"type":"boolean","description":"Billed every period of the deal’s schedule."}},"required":["id","article_number","description","quantity","price","per_period"],"additionalProperties":false}},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the deal was given, if any."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","title","party","contact","stage","probability","owner","close_date","status","closed_at","lost_reason","lost_reason_text","competitor_name","won_document","currency","value","rows_total","rows","external_id","created_at","updated_at"],"additionalProperties":false}},"required":["id","deal_id","document","status","number","customer","created_at","updated_at","deal"],"additionalProperties":false}}}},"201":{"description":"Created.","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"deal_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"document":{"type":"string","enum":["quote","order","invoice"]},"status":{"type":"string","enum":["pending","written"],"description":"`pending`: Fortnox’s answer never arrived, so the document, and for a lead the customer, may or may not exist. Check Fortnox, then confirm it to send it again or drop it; nothing is sent until you confirm."},"number":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The document’s number in Fortnox, once written."},"customer":{"anyOf":[{"type":"object","properties":{"number":{"type":"string"},"created":{"type":"boolean","description":"The lead was added to Fortnox as this customer."}},"required":["number","created"],"additionalProperties":false},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"deal":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"},"party":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"contact":{"anyOf":[{"type":"object","properties":{"id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"Null for a name typed before contacts were picked."},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"stage":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"probability":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Win probability in percent: the deal’s own, else its stage’s."},"owner":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null for a deal imported from Fortnox that nobody owns."},"close_date":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"status":{"type":"string","enum":["open","won","lost"]},"closed_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"When it was won or lost; null while open."},"lost_reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"lost_reason_text":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The reason in the seller’s words, for `other`."},"competitor_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"won_document":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["order","invoice"]},"number":{"type":"string"}},"required":["type","number"],"additionalProperties":false},{"type":"null"}],"description":"The Fortnox order or invoice the deal was won with."},"currency":{"type":"string","description":"ISO 4217. Every amount on the deal is in it, excluding VAT."},"value":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The value a seller gave the deal; null for none."},"rows_total":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The rows summed, rows per period over twelve months of its schedule, with freight and invoicing fee; null without rows."},"rows":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"article_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per unit, excluding VAT."},"per_period":{"type":"boolean","description":"Billed every period of the deal’s schedule."}},"required":["id","article_number","description","quantity","price","per_period"],"additionalProperties":false}},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the deal was given, if any."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","title","party","contact","stage","probability","owner","close_date","status","closed_at","lost_reason","lost_reason_text","competitor_name","won_document","currency","value","rows_total","rows","external_id","created_at","updated_at"],"additionalProperties":false}},"required":["id","deal_id","document","status","number","customer","created_at","updated_at","deal"],"additionalProperties":false}}}},"202":{"description":"Pending again: Fortnox’s answer was lost once more.","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"deal_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"document":{"type":"string","enum":["quote","order","invoice"]},"status":{"type":"string","enum":["pending","written"],"description":"`pending`: Fortnox’s answer never arrived, so the document, and for a lead the customer, may or may not exist. Check Fortnox, then confirm it to send it again or drop it; nothing is sent until you confirm."},"number":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The document’s number in Fortnox, once written."},"customer":{"anyOf":[{"type":"object","properties":{"number":{"type":"string"},"created":{"type":"boolean","description":"The lead was added to Fortnox as this customer."}},"required":["number","created"],"additionalProperties":false},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"deal":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"},"party":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"contact":{"anyOf":[{"type":"object","properties":{"id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"Null for a name typed before contacts were picked."},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"stage":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"probability":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Win probability in percent: the deal’s own, else its stage’s."},"owner":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null for a deal imported from Fortnox that nobody owns."},"close_date":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"status":{"type":"string","enum":["open","won","lost"]},"closed_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"When it was won or lost; null while open."},"lost_reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"lost_reason_text":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The reason in the seller’s words, for `other`."},"competitor_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"won_document":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["order","invoice"]},"number":{"type":"string"}},"required":["type","number"],"additionalProperties":false},{"type":"null"}],"description":"The Fortnox order or invoice the deal was won with."},"currency":{"type":"string","description":"ISO 4217. Every amount on the deal is in it, excluding VAT."},"value":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The value a seller gave the deal; null for none."},"rows_total":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The rows summed, rows per period over twelve months of its schedule, with freight and invoicing fee; null without rows."},"rows":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"article_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"type":"number"},"price":{"type":"number","description":"Per unit, excluding VAT."},"per_period":{"type":"boolean","description":"Billed every period of the deal’s schedule."}},"required":["id","article_number","description","quantity","price","per_period"],"additionalProperties":false}},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the deal was given, if any."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","title","party","contact","stage","probability","owner","close_date","status","closed_at","lost_reason","lost_reason_text","competitor_name","won_document","currency","value","rows_total","rows","external_id","created_at","updated_at"],"additionalProperties":false}},"required":["id","deal_id","document","status","number","customer","created_at","updated_at","deal"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The write conflicts with what the book holds; `error.code` says how.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The `Idempotency-Key` was already used for a different request, or Fortnox refused the document; `error.code` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"A service the write needs did not answer, writes to Fortnox are paused, or the service connection needs re-consent; `error.code` says which. See `Retry-After`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/tasks":{"get":{"operationId":"listTasks","summary":"List tasks","description":"Every task in the company, open, done and cancelled, whoever owes it, oldest change first. With `scheme` and `value`, the task holding that `external_id`.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"changed_since","in":"query","required":false,"description":"Only records that changed at or after this time (ISO 8601). Removals are not listed.","schema":{"description":"Only records that changed at or after this time (ISO 8601). Removals are not listed.","type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"cursor","in":"query","required":false,"description":"The `next_cursor` of the previous page. Leave it out for the first page.","schema":{"description":"The `next_cursor` of the previous page. Leave it out for the first page.","type":"string","maxLength":200}},{"name":"limit","in":"query","required":false,"description":"Records per page, 1 to 500.","schema":{"default":100,"description":"Records per page, 1 to 500.","type":"integer","minimum":1,"maximum":500}},{"name":"party_id","in":"query","required":false,"description":"Only the tasks about this party.","schema":{"description":"Only the tasks about this party.","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"deal_id","in":"query","required":false,"description":"Only the tasks on this deal.","schema":{"description":"Only the tasks on this deal.","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"scheme","in":"query","required":false,"description":"With `value`: only the record holding this `external_id`.","schema":{"description":"With `value`: only the record holding this `external_id`.","type":"string","maxLength":40}},{"name":"value","in":"query","required":false,"description":"With `scheme`: the `external_id`’s value.","schema":{"description":"With `scheme`: the `external_id`’s value.","type":"string","maxLength":200}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"},"type":{"type":"string","enum":["call","email","todo"]},"party":{"anyOf":[{"type":"object","properties":{"id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Who it is about; `id` null for a name typed before parties were picked."},"contact":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"deal":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"}},"required":["id","title"],"additionalProperties":false},{"type":"null"}],"description":"The deal it moves forward."},"assignee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Who owes it; null when Aira does it."},"created_by":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null once the member’s account is gone."},"created_by_aira":{"type":"boolean"},"due_date":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}],"description":"A calendar day; null for someday."},"status":{"type":"string","enum":["open","done","cancelled"]},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the task was given, if any."},"completed_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}]},"cancelled_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"Closed without being done: its party was removed."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","title","type","party","contact","deal","assignee","created_by","created_by_aira","due_date","status","external_id","completed_at","cancelled_at","created_at","updated_at"],"additionalProperties":false}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next_cursor"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createTask","summary":"Create a task","description":"A task in Uppgifter, on a party or a deal or on no one, made by the key’s maker as Ny uppgift makes one. An `external_id` another task holds, done or not, is refused with `identifier_conflict`.\n\nScope: `write_aira`.","security":[{"apiKey":["write_aira"]}],"x-scope":"write_aira","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, up to 255 characters. The same key sent again with the same request within a day replays the first success, with `Idempotent-Replayed: true`, instead of writing twice; a refused call keeps nothing, so a corrected one may reuse its key. Sent with a different request after a success it is refused (422).","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":500},"type":{"description":"Defaults to `todo`.","type":"string","enum":["call","email","todo"]},"due_date":{"description":"A calendar day; null or left out for someday.","anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"party_id":{"description":"Who it is about.","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"deal_id":{"description":"The deal it moves forward; the task is about the deal’s party.","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"contact_id":{"description":"A contact at its party.","anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"assignee_id":{"description":"Any member of the company, who is told. Left out, the owner of its deal, else the member linked to its party’s Kundansvarig, else the key’s maker.","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"external_id":{"type":"object","properties":{"scheme":{"type":"string","pattern":"^[a-z][a-z0-9_.-]{0,39}$","description":"Your system’s name, lowercase, e.g. `aira` or `hubspot`."},"value":{"type":"string","minLength":1,"maxLength":200,"description":"The task’s id in your system."}},"required":["scheme","value"],"description":"An id of your own system, stored on the task: list `?scheme=&value=` to find the same task."}},"required":["title"]}}}},"responses":{"200":{"description":"OK: the record was already in the book, and this is it.","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"},"type":{"type":"string","enum":["call","email","todo"]},"party":{"anyOf":[{"type":"object","properties":{"id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Who it is about; `id` null for a name typed before parties were picked."},"contact":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"deal":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"}},"required":["id","title"],"additionalProperties":false},{"type":"null"}],"description":"The deal it moves forward."},"assignee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Who owes it; null when Aira does it."},"created_by":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null once the member’s account is gone."},"created_by_aira":{"type":"boolean"},"due_date":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}],"description":"A calendar day; null for someday."},"status":{"type":"string","enum":["open","done","cancelled"]},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the task was given, if any."},"completed_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}]},"cancelled_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"Closed without being done: its party was removed."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","title","type","party","contact","deal","assignee","created_by","created_by_aira","due_date","status","external_id","completed_at","cancelled_at","created_at","updated_at"],"additionalProperties":false}}}},"201":{"description":"Created.","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"},"type":{"type":"string","enum":["call","email","todo"]},"party":{"anyOf":[{"type":"object","properties":{"id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Who it is about; `id` null for a name typed before parties were picked."},"contact":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"deal":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"}},"required":["id","title"],"additionalProperties":false},{"type":"null"}],"description":"The deal it moves forward."},"assignee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Who owes it; null when Aira does it."},"created_by":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null once the member’s account is gone."},"created_by_aira":{"type":"boolean"},"due_date":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}],"description":"A calendar day; null for someday."},"status":{"type":"string","enum":["open","done","cancelled"]},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the task was given, if any."},"completed_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}]},"cancelled_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"Closed without being done: its party was removed."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","title","type","party","contact","deal","assignee","created_by","created_by_aira","due_date","status","external_id","completed_at","cancelled_at","created_at","updated_at"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The write conflicts with what the book holds; `error.code` says how.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The `Idempotency-Key` was already used for a different request, or Fortnox refused the document; `error.code` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/tasks/{id}":{"get":{"operationId":"getTask","summary":"Read a task","description":"One task.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"},"type":{"type":"string","enum":["call","email","todo"]},"party":{"anyOf":[{"type":"object","properties":{"id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Who it is about; `id` null for a name typed before parties were picked."},"contact":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"deal":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"}},"required":["id","title"],"additionalProperties":false},{"type":"null"}],"description":"The deal it moves forward."},"assignee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Who owes it; null when Aira does it."},"created_by":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null once the member’s account is gone."},"created_by_aira":{"type":"boolean"},"due_date":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}],"description":"A calendar day; null for someday."},"status":{"type":"string","enum":["open","done","cancelled"]},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the task was given, if any."},"completed_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}]},"cancelled_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"Closed without being done: its party was removed."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","title","type","party","contact","deal","assignee","created_by","created_by_aira","due_date","status","external_id","completed_at","cancelled_at","created_at","updated_at"],"additionalProperties":false}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"editTask","summary":"Edit a task","description":"Changes what is sent and leaves the rest, on any task of the company. Refused with `identifier_conflict` for an `external_id` another task holds.\n\nScope: `write_aira`.","security":[{"apiKey":["write_aira"]}],"x-scope":"write_aira","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, up to 255 characters. The same key sent again with the same request within a day replays the first success, with `Idempotent-Replayed: true`, instead of writing twice; a refused call keeps nothing, so a corrected one may reuse its key. Sent with a different request after a success it is refused (422).","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":500},"type":{"type":"string","enum":["call","email","todo"]},"due_date":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}]},"status":{"description":"Ticks it off, or back on.","type":"string","enum":["open","done"]},"party_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"contact_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"assignee_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"external_id":{"description":"Null takes it off.","anyOf":[{"type":"object","properties":{"scheme":{"type":"string","pattern":"^[a-z][a-z0-9_.-]{0,39}$","description":"Your system’s name, lowercase, e.g. `aira` or `hubspot`."},"value":{"type":"string","minLength":1,"maxLength":200,"description":"The task’s id in your system."}},"required":["scheme","value"],"description":"An id of your own system, stored on the task: list `?scheme=&value=` to find the same task."},{"type":"null"}]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"},"type":{"type":"string","enum":["call","email","todo"]},"party":{"anyOf":[{"type":"object","properties":{"id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Who it is about; `id` null for a name typed before parties were picked."},"contact":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"deal":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"}},"required":["id","title"],"additionalProperties":false},{"type":"null"}],"description":"The deal it moves forward."},"assignee":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Who owes it; null when Aira does it."},"created_by":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null once the member’s account is gone."},"created_by_aira":{"type":"boolean"},"due_date":{"anyOf":[{"type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},{"type":"null"}],"description":"A calendar day; null for someday."},"status":{"type":"string","enum":["open","done","cancelled"]},"external_id":{"anyOf":[{"type":"object","properties":{"scheme":{"type":"string"},"value":{"type":"string"}},"required":["scheme","value"],"additionalProperties":false},{"type":"null"}],"description":"The id of your own system the task was given, if any."},"completed_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}]},"cancelled_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"Closed without being done: its party was removed."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","title","type","party","contact","deal","assignee","created_by","created_by_aira","due_date","status","external_id","completed_at","cancelled_at","created_at","updated_at"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The write conflicts with what the book holds; `error.code` says how.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The `Idempotency-Key` was already used for a different request, or Fortnox refused the document; `error.code` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"removeTask","summary":"Remove a task","description":"Deletes a task written by mistake or not to be done, as on screen: any member may, and its assignee, when someone else deletes it, is told and can undo it in Aira. Tick a task off with `status: done` instead once it is done.\n\nScope: `write_aira`.","security":[{"apiKey":["write_aira"]}],"x-scope":"write_aira","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, up to 255 characters. The same key sent again with the same request within a day replays the first success, with `Idempotent-Replayed: true`, instead of writing twice; a refused call keeps nothing, so a corrected one may reuse its key. Sent with a different request after a success it is refused (422).","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"removed":{"type":"boolean","const":true}},"required":["id","removed"],"additionalProperties":false}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The `Idempotency-Key` was already used for a different request, or Fortnox refused the document; `error.code` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/meetings":{"get":{"operationId":"listMeetings","summary":"List meetings","description":"The meetings on the company’s companies, as the key’s maker sees them. A meeting several members’ calendars hold is listed once. Oldest change first, at most 50 a page; a page may hold fewer while `next_cursor` is set.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"changed_since","in":"query","required":false,"description":"Only records that changed at or after this time (ISO 8601). Removals are not listed.","schema":{"description":"Only records that changed at or after this time (ISO 8601). Removals are not listed.","type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"cursor","in":"query","required":false,"description":"The `next_cursor` of the previous page. Leave it out for the first page.","schema":{"description":"The `next_cursor` of the previous page. Leave it out for the first page.","type":"string","maxLength":200}},{"name":"limit","in":"query","required":false,"schema":{"default":50,"type":"integer","minimum":1,"maximum":50}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"private":{"type":"boolean","description":"Private in a calendar: only its time is shown. Title, place, attendees, companies, deals and the recording are empty."},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"As the meeting view shows it; null when private."},"cancelled":{"type":"boolean"},"not_held":{"type":"boolean","description":"Marked as not held in Aira."},"all_day":{"type":"boolean"},"starts_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"ends_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}]},"online":{"type":"boolean"},"location":{"anyOf":[{"type":"string"},{"type":"null"}]},"logged":{"type":"boolean","description":"Logged in Aira rather than read from a calendar."},"our_side":{"type":"array","items":{"type":"string"},"description":"The members whose calendar holds it, or who logged it."},"attendees":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"organizer":{"type":"boolean"}},"required":["name","email","organizer"],"additionalProperties":false}},"companies":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false}},"deals":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"}},"required":["id","title"],"additionalProperties":false}},"recording":{"anyOf":[{"type":"object","properties":{"state":{"type":"string","enum":["processing","ready","failed"],"description":"`ready` once the recording is stored and can be downloaded."},"content_type":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"`video/mp4` for a call, an audio type for a meeting recorded in the room; null until ready."},"bytes":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"duration_seconds":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["state","content_type","bytes","duration_seconds"],"additionalProperties":false,"description":"The mötesassistent’s recording, once the call has ended; null when nothing was recorded. Download it from `/meetings/{id}/recording`."},{"type":"null"}]},"transcript":{"anyOf":[{"type":"object","properties":{"state":{"type":"string","enum":["processing","ready","unavailable"],"description":"`ready` when `/meetings/{id}/transcript` has its turns; `unavailable` when there will be none."},"duration_seconds":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["state","duration_seconds"],"additionalProperties":false,"description":"The recording’s transcript; null exactly when `recording` is."},{"type":"null"}]},"debrief":{"anyOf":[{"type":"object","properties":{"state":{"type":"string","enum":["writing","ready","skipped","failed","unavailable"],"description":"`writing` until it is ready; `skipped` for a call too short or empty to summarise; `unavailable` without a transcript to write from. Every field below is null unless `ready`."},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Det här hände: what came out of the meeting."},"purpose":{"anyOf":[{"type":"object","properties":{"ours":{"type":"string","description":"Our side of the Brief’s Syfte."},"reached":{"anyOf":[{"type":"string","enum":["yes","partly","no"]},{"type":"null"}]}},"required":["ours","reached"],"additionalProperties":false},{"type":"null"}],"description":"Syftet: what we came for and whether we got it; null without one."},"flagged":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"text":{"type":"string"},"kind":{"type":"string","enum":["risk","open"]}},"required":["text","kind"],"additionalProperties":false}},{"type":"null"}],"description":"Aira uppmärksammade: what the meeting left open (`open`) or what can cost the deal (`risk`). Null on a Sammanfattning written before it."},"decisions":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"description":"Beslut: what both sides agreed. Null on one written before it."},"next_steps":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"task":{"type":"string"},"owner":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Who said they would do it, by name; null for a step Aira suggests."},"deadline":{"anyOf":[{"type":"string"},{"type":"null"}]},"side":{"type":"string","enum":["ours","theirs"],"description":"Our side of the meeting, or the other."},"suggested_by_aira":{"type":"boolean","description":"Förslag från Aira: Aira’s suggestion, not something anyone in the meeting promised."}},"required":["task","owner","deadline","side","suggested_by_aira"],"additionalProperties":false}},{"type":"null"}],"description":"Nästa steg: ours, then theirs, then Aira’s suggestions."},"topics":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"topic":{"type":"string"},"points":{"type":"array","items":{"type":"string"}},"starts_at_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Where in the recording talk of it starts."}},"required":["topic","points","starts_at_seconds"],"additionalProperties":false}},{"type":"null"}],"description":"Det här togs upp."}},"required":["state","title","summary","purpose","flagged","decisions","next_steps","topics"],"additionalProperties":false,"description":"Sammanfattning: what Aira wrote about the meeting for this company, from its transcript and notes. Null when it has none."},{"type":"null"}]},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$","description":"Its last change, its recording’s, transcript’s and Sammanfattning’s included: a transcript arriving after the call lists the meeting again under `changed_since`."}},"required":["id","private","title","cancelled","not_held","all_day","starts_at","ends_at","online","location","logged","our_side","attendees","companies","deals","recording","transcript","debrief","updated_at"],"additionalProperties":false}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next_cursor"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/meetings/{id}":{"get":{"operationId":"getMeeting","summary":"Read a meeting","description":"One meeting, as the key’s maker sees it.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"private":{"type":"boolean","description":"Private in a calendar: only its time is shown. Title, place, attendees, companies, deals and the recording are empty."},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"As the meeting view shows it; null when private."},"cancelled":{"type":"boolean"},"not_held":{"type":"boolean","description":"Marked as not held in Aira."},"all_day":{"type":"boolean"},"starts_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"ends_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}]},"online":{"type":"boolean"},"location":{"anyOf":[{"type":"string"},{"type":"null"}]},"logged":{"type":"boolean","description":"Logged in Aira rather than read from a calendar."},"our_side":{"type":"array","items":{"type":"string"},"description":"The members whose calendar holds it, or who logged it."},"attendees":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"organizer":{"type":"boolean"}},"required":["name","email","organizer"],"additionalProperties":false}},"companies":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false}},"deals":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"title":{"type":"string"}},"required":["id","title"],"additionalProperties":false}},"recording":{"anyOf":[{"type":"object","properties":{"state":{"type":"string","enum":["processing","ready","failed"],"description":"`ready` once the recording is stored and can be downloaded."},"content_type":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"`video/mp4` for a call, an audio type for a meeting recorded in the room; null until ready."},"bytes":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"duration_seconds":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["state","content_type","bytes","duration_seconds"],"additionalProperties":false,"description":"The mötesassistent’s recording, once the call has ended; null when nothing was recorded. Download it from `/meetings/{id}/recording`."},{"type":"null"}]},"transcript":{"anyOf":[{"type":"object","properties":{"state":{"type":"string","enum":["processing","ready","unavailable"],"description":"`ready` when `/meetings/{id}/transcript` has its turns; `unavailable` when there will be none."},"duration_seconds":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["state","duration_seconds"],"additionalProperties":false,"description":"The recording’s transcript; null exactly when `recording` is."},{"type":"null"}]},"debrief":{"anyOf":[{"type":"object","properties":{"state":{"type":"string","enum":["writing","ready","skipped","failed","unavailable"],"description":"`writing` until it is ready; `skipped` for a call too short or empty to summarise; `unavailable` without a transcript to write from. Every field below is null unless `ready`."},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Det här hände: what came out of the meeting."},"purpose":{"anyOf":[{"type":"object","properties":{"ours":{"type":"string","description":"Our side of the Brief’s Syfte."},"reached":{"anyOf":[{"type":"string","enum":["yes","partly","no"]},{"type":"null"}]}},"required":["ours","reached"],"additionalProperties":false},{"type":"null"}],"description":"Syftet: what we came for and whether we got it; null without one."},"flagged":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"text":{"type":"string"},"kind":{"type":"string","enum":["risk","open"]}},"required":["text","kind"],"additionalProperties":false}},{"type":"null"}],"description":"Aira uppmärksammade: what the meeting left open (`open`) or what can cost the deal (`risk`). Null on a Sammanfattning written before it."},"decisions":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"description":"Beslut: what both sides agreed. Null on one written before it."},"next_steps":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"task":{"type":"string"},"owner":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Who said they would do it, by name; null for a step Aira suggests."},"deadline":{"anyOf":[{"type":"string"},{"type":"null"}]},"side":{"type":"string","enum":["ours","theirs"],"description":"Our side of the meeting, or the other."},"suggested_by_aira":{"type":"boolean","description":"Förslag från Aira: Aira’s suggestion, not something anyone in the meeting promised."}},"required":["task","owner","deadline","side","suggested_by_aira"],"additionalProperties":false}},{"type":"null"}],"description":"Nästa steg: ours, then theirs, then Aira’s suggestions."},"topics":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"topic":{"type":"string"},"points":{"type":"array","items":{"type":"string"}},"starts_at_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Where in the recording talk of it starts."}},"required":["topic","points","starts_at_seconds"],"additionalProperties":false}},{"type":"null"}],"description":"Det här togs upp."}},"required":["state","title","summary","purpose","flagged","decisions","next_steps","topics"],"additionalProperties":false,"description":"Sammanfattning: what Aira wrote about the meeting for this company, from its transcript and notes. Null when it has none."},{"type":"null"}]},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$","description":"Its last change, its recording’s, transcript’s and Sammanfattning’s included: a transcript arriving after the call lists the meeting again under `changed_since`."}},"required":["id","private","title","cancelled","not_held","all_day","starts_at","ends_at","online","location","logged","our_side","attendees","companies","deals","recording","transcript","debrief","updated_at"],"additionalProperties":false}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/meetings/{id}/transcript":{"get":{"operationId":"getMeetingTranscript","summary":"Read a meeting’s transcript","description":"What was said in a recorded meeting, turn by turn, with who said it. A recording shared with another company’s calendar is the same recording for both. 404 for a meeting with no recording.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"meeting_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"state":{"type":"string","enum":["processing","ready","unavailable"]},"duration_seconds":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"turns":{"type":"array","items":{"type":"object","properties":{"speaker":{"anyOf":[{"type":"object","properties":{"name":{"type":"string","description":"Who spoke, or a label such as _Talare 2_ for a voice nobody has named."},"contact_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"The contact it is, as `/contacts/{id}` reads it, when it is one of yours."},"named":{"type":"boolean","description":"False while `name` is only a label. A call’s speakers are named by the call itself."},"confirmed":{"type":"boolean","description":"A person said who it is, rather than Aira telling it from what was said."}},"required":["name","contact_id","named","confirmed"],"additionalProperties":false},{"type":"null"}],"description":"Null on a line marking where the recording paused."},"starts_at_seconds":{"type":"number","description":"Seconds into the recording."},"text":{"type":"string"}},"required":["speaker","starts_at_seconds","text"],"additionalProperties":false},"description":"Each speaker turn in order; empty until `state` is `ready`."}},"required":["meeting_id","state","duration_seconds","turns"],"additionalProperties":false}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/meetings/{id}/recording":{"get":{"operationId":"getMeetingRecording","summary":"Link to a meeting’s recording","description":"A short-lived link to the recording’s bytes. 404 for a meeting whose recording is not ready.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"url":{"type":"string","description":"The recording’s bytes for this key, without the key, in byte ranges if asked. It expires at `expires_at`; ask again for a new one."},"expires_at":{"type":"string"},"content_type":{"type":"string"},"bytes":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["url","expires_at","content_type","bytes"],"additionalProperties":false}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/meetings/{id}/recording/content":{"get":{"operationId":"downloadMeetingRecording","summary":"Download a meeting’s recording","description":"The recording’s bytes as their own type, in byte ranges if asked (`Range`). Called with the `url` a recording link gave, which carries its own authorisation: no API key. An expired link, or one whose key is revoked, answers 404.","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}},{"name":"token","in":"query","required":true,"description":"Part of the download link.","schema":{"type":"string"}}],"security":[],"responses":{"200":{"description":"The recording’s bytes.","content":{"video/mp4":{"schema":{"type":"string","format":"binary"}},"audio/aac":{"schema":{"type":"string","format":"binary"}}}},"206":{"description":"The byte range asked for in `Range`."},"404":{"description":"No such recording, or a link that no longer opens it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"416":{"description":"A `Range` outside the recording."},"429":{"description":"Too many calls with the key that made the link. See `Retry-After`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/emails":{"get":{"operationId":"listEmails","summary":"List emails","description":"The mail on the company’s cards: every conversation with one of its companies that a member’s connected mailbox holds, as every member sees it there. Mail that reached no company, and mail among colleagues, is not listed. An email in several members’ mailboxes is listed once. Oldest change first, at most 100 a page; a page may hold fewer while `next_cursor` is set. Mail that later leaves a card is not listed as removed.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"changed_since","in":"query","required":false,"description":"Only records that changed at or after this time (ISO 8601). Removals are not listed.","schema":{"description":"Only records that changed at or after this time (ISO 8601). Removals are not listed.","type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"cursor","in":"query","required":false,"description":"The `next_cursor` of the previous page. Leave it out for the first page.","schema":{"description":"The `next_cursor` of the previous page. Leave it out for the first page.","type":"string","maxLength":200}},{"name":"limit","in":"query","required":false,"schema":{"default":100,"type":"integer","minimum":1,"maximum":100}},{"name":"party_id","in":"query","required":false,"description":"Only the mail on this party’s card.","schema":{"description":"Only the mail on this party’s card.","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"thread_id","in":"query","required":false,"description":"Only this conversation’s mail.","schema":{"description":"Only this conversation’s mail.","type":"string","maxLength":2000}},{"name":"contact_id","in":"query","required":false,"description":"Only mail this contact’s address is on.","schema":{"description":"Only mail this contact’s address is on.","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"thread_id":{"type":"string","description":"The conversation, the same across every mailbox that holds a copy. Group by it for threads; filter by it with `thread_id`."},"party_ids":{"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"description":"The parties on whose card it shows: usually one, two when the thread is with both."},"direction":{"type":"string","enum":["inbound","outbound"],"description":"`inbound` from them, `outbound` from one of us."},"sent_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"from":{"anyOf":[{"type":"object","properties":{"address":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The display name the header gave, if any."},"contact_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"The contact at this address, as `/contacts/{id}` reads it, when exactly one has it."}},"required":["address","name","contact_id"],"additionalProperties":false},{"type":"null"}]},"to":{"type":"array","items":{"type":"object","properties":{"address":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The display name the header gave, if any."},"contact_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"The contact at this address, as `/contacts/{id}` reads it, when exactly one has it."}},"required":["address","name","contact_id"],"additionalProperties":false}},"cc":{"type":"array","items":{"type":"object","properties":{"address":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The display name the header gave, if any."},"contact_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"The contact at this address, as `/contacts/{id}` reads it, when exactly one has it."}},"required":["address","name","contact_id"],"additionalProperties":false}},"held_by":{"type":"array","items":{"type":"string"},"description":"The members whose mailbox holds a copy, by name, as the card names them."},"body_text":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The `text/plain` part, as sent; null when it had none."},"file_ids":{"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"description":"Its attachments that are files, read through `/files/{id}`."},"updated_at":{"type":"string","description":"When it last reached or moved between cards, else when it came into Aira. Lists sort by it, and `changed_since` compares with it: mail linked to a company later is listed then."}},"required":["id","thread_id","party_ids","direction","sent_at","subject","from","to","cc","held_by","body_text","file_ids","updated_at"],"additionalProperties":false}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next_cursor"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/emails/{id}":{"get":{"operationId":"getEmail","summary":"Read an email","description":"One email with its HTML part too.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"thread_id":{"type":"string","description":"The conversation, the same across every mailbox that holds a copy. Group by it for threads; filter by it with `thread_id`."},"party_ids":{"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"description":"The parties on whose card it shows: usually one, two when the thread is with both."},"direction":{"type":"string","enum":["inbound","outbound"],"description":"`inbound` from them, `outbound` from one of us."},"sent_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"from":{"anyOf":[{"type":"object","properties":{"address":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The display name the header gave, if any."},"contact_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"The contact at this address, as `/contacts/{id}` reads it, when exactly one has it."}},"required":["address","name","contact_id"],"additionalProperties":false},{"type":"null"}]},"to":{"type":"array","items":{"type":"object","properties":{"address":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The display name the header gave, if any."},"contact_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"The contact at this address, as `/contacts/{id}` reads it, when exactly one has it."}},"required":["address","name","contact_id"],"additionalProperties":false}},"cc":{"type":"array","items":{"type":"object","properties":{"address":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The display name the header gave, if any."},"contact_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"The contact at this address, as `/contacts/{id}` reads it, when exactly one has it."}},"required":["address","name","contact_id"],"additionalProperties":false}},"held_by":{"type":"array","items":{"type":"string"},"description":"The members whose mailbox holds a copy, by name, as the card names them."},"body_text":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The `text/plain` part, as sent; null when it had none."},"file_ids":{"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"description":"Its attachments that are files, read through `/files/{id}`."},"updated_at":{"type":"string","description":"When it last reached or moved between cards, else when it came into Aira. Lists sort by it, and `changed_since` compares with it: mail linked to a company later is listed then."},"body_html":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The `text/html` part exactly as sent, not sanitised: sanitise it before you show it."}},"required":["id","thread_id","party_ids","direction","sent_at","subject","from","to","cc","held_by","body_text","file_ids","updated_at","body_html"],"additionalProperties":false}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/notes":{"get":{"operationId":"listNotes","summary":"List notes","description":"The notes on the parties, deals, tasks and meetings the key’s maker sees, oldest change first. A page may hold fewer than `limit` while `next_cursor` is set.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"changed_since","in":"query","required":false,"description":"Only records that changed at or after this time (ISO 8601). Removals are not listed.","schema":{"description":"Only records that changed at or after this time (ISO 8601). Removals are not listed.","type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"cursor","in":"query","required":false,"description":"The `next_cursor` of the previous page. Leave it out for the first page.","schema":{"description":"The `next_cursor` of the previous page. Leave it out for the first page.","type":"string","maxLength":200}},{"name":"limit","in":"query","required":false,"description":"Records per page, 1 to 500.","schema":{"default":100,"description":"Records per page, 1 to 500.","type":"integer","minimum":1,"maximum":500}},{"name":"party_id","in":"query","required":false,"description":"Only the notes on this party.","schema":{"description":"Only the notes on this party.","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"deal_id","in":"query","required":false,"description":"Only the notes on this deal.","schema":{"description":"Only the notes on this deal.","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"task_id","in":"query","required":false,"description":"Only the notes on this task.","schema":{"description":"Only the notes on this task.","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"meeting_id","in":"query","required":false,"description":"Only the notes on this meeting.","schema":{"description":"Only the notes on this meeting.","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"body":{"type":"string"},"author":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null once the member’s account is gone."},"written_by_aira":{"type":"boolean","description":"Aira wrote it when its author asked."},"pinned":{"type":"boolean","description":"Pinned on its party as the one thing to know; at most one per party."},"party":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id"],"additionalProperties":false},{"type":"null"}]},"deal":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id"],"additionalProperties":false},{"type":"null"}],"description":"Null once the deal is removed."},"task":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id"],"additionalProperties":false},{"type":"null"}]},"meeting":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id"],"additionalProperties":false},{"type":"null"}],"description":"The meeting it was written on, by its id in `/meetings`; null once no calendar holds it, or while it is private."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"edited_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"When its author last changed the words."},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","body","author","written_by_aira","pinned","party","deal","task","meeting","created_at","edited_at","updated_at"],"additionalProperties":false}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next_cursor"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createNote","summary":"Write a note","description":"A note on exactly one of a party, a deal, a task or a meeting, written by the key’s maker as Anteckning writes it.\n\nScope: `write_aira`.","security":[{"apiKey":["write_aira"]}],"x-scope":"write_aira","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, up to 255 characters. The same key sent again with the same request within a day replays the first success, with `Idempotent-Replayed: true`, instead of writing twice; a refused call keeps nothing, so a corrected one may reuse its key. Sent with a different request after a success it is refused (422).","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"body":{"type":"string","minLength":1,"maxLength":10000},"party_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"deal_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"task_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"meeting_id":{"description":"A meeting by its id in `/meetings`.","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["body"]}}}},"responses":{"200":{"description":"OK: the record was already in the book, and this is it.","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"body":{"type":"string"},"author":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null once the member’s account is gone."},"written_by_aira":{"type":"boolean","description":"Aira wrote it when its author asked."},"pinned":{"type":"boolean","description":"Pinned on its party as the one thing to know; at most one per party."},"party":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id"],"additionalProperties":false},{"type":"null"}]},"deal":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id"],"additionalProperties":false},{"type":"null"}],"description":"Null once the deal is removed."},"task":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id"],"additionalProperties":false},{"type":"null"}]},"meeting":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id"],"additionalProperties":false},{"type":"null"}],"description":"The meeting it was written on, by its id in `/meetings`; null once no calendar holds it, or while it is private."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"edited_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"When its author last changed the words."},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","body","author","written_by_aira","pinned","party","deal","task","meeting","created_at","edited_at","updated_at"],"additionalProperties":false}}}},"201":{"description":"Created.","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"body":{"type":"string"},"author":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null once the member’s account is gone."},"written_by_aira":{"type":"boolean","description":"Aira wrote it when its author asked."},"pinned":{"type":"boolean","description":"Pinned on its party as the one thing to know; at most one per party."},"party":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id"],"additionalProperties":false},{"type":"null"}]},"deal":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id"],"additionalProperties":false},{"type":"null"}],"description":"Null once the deal is removed."},"task":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id"],"additionalProperties":false},{"type":"null"}]},"meeting":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id"],"additionalProperties":false},{"type":"null"}],"description":"The meeting it was written on, by its id in `/meetings`; null once no calendar holds it, or while it is private."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"edited_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"When its author last changed the words."},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","body","author","written_by_aira","pinned","party","deal","task","meeting","created_at","edited_at","updated_at"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The `Idempotency-Key` was already used for a different request, or Fortnox refused the document; `error.code` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/notes/{id}":{"get":{"operationId":"getNote","summary":"Read a note","description":"One note.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"body":{"type":"string"},"author":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null once the member’s account is gone."},"written_by_aira":{"type":"boolean","description":"Aira wrote it when its author asked."},"pinned":{"type":"boolean","description":"Pinned on its party as the one thing to know; at most one per party."},"party":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id"],"additionalProperties":false},{"type":"null"}]},"deal":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id"],"additionalProperties":false},{"type":"null"}],"description":"Null once the deal is removed."},"task":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id"],"additionalProperties":false},{"type":"null"}]},"meeting":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id"],"additionalProperties":false},{"type":"null"}],"description":"The meeting it was written on, by its id in `/meetings`; null once no calendar holds it, or while it is private."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"edited_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"When its author last changed the words."},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","body","author","written_by_aira","pinned","party","deal","task","meeting","created_at","edited_at","updated_at"],"additionalProperties":false}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"editNote","summary":"Edit a note","description":"Its words, which only its author changes (`not_permitted` for anyone else), or whether it is pinned.\n\nScope: `write_aira`.","security":[{"apiKey":["write_aira"]}],"x-scope":"write_aira","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, up to 255 characters. The same key sent again with the same request within a day replays the first success, with `Idempotent-Replayed: true`, instead of writing twice; a refused call keeps nothing, so a corrected one may reuse its key. Sent with a different request after a success it is refused (422).","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"body":{"description":"Only the note’s author changes its words.","type":"string","minLength":1,"maxLength":10000},"pinned":{"description":"Pinned on its party as the one thing to know; pinning unpins its other note.","type":"boolean"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"body":{"type":"string"},"author":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}],"description":"Null once the member’s account is gone."},"written_by_aira":{"type":"boolean","description":"Aira wrote it when its author asked."},"pinned":{"type":"boolean","description":"Pinned on its party as the one thing to know; at most one per party."},"party":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id"],"additionalProperties":false},{"type":"null"}]},"deal":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id"],"additionalProperties":false},{"type":"null"}],"description":"Null once the deal is removed."},"task":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id"],"additionalProperties":false},{"type":"null"}]},"meeting":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["id"],"additionalProperties":false},{"type":"null"}],"description":"The meeting it was written on, by its id in `/meetings`; null once no calendar holds it, or while it is private."},"created_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"edited_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},{"type":"null"}],"description":"When its author last changed the words."},"updated_at":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{6}(?:Z))$"}},"required":["id","body","author","written_by_aira","pinned","party","deal","task","meeting","created_at","edited_at","updated_at"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The `Idempotency-Key` was already used for a different request, or Fortnox refused the document; `error.code` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"removeNote","summary":"Remove a note","description":"Any member removes any note, as on screen. It is kept, so its author can undo it, and read nowhere again: a second removal is a 404.\n\nScope: `write_aira`.","security":[{"apiKey":["write_aira"]}],"x-scope":"write_aira","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, up to 255 characters. The same key sent again with the same request within a day replays the first success, with `Idempotent-Replayed: true`, instead of writing twice; a refused call keeps nothing, so a corrected one may reuse its key. Sent with a different request after a success it is refused (422).","schema":{"type":"string","maxLength":255}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"removed":{"type":"boolean","const":true}},"required":["id","removed"],"additionalProperties":false}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The `Idempotency-Key` was already used for a different request, or Fortnox refused the document; `error.code` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/documents":{"get":{"operationId":"listDocuments","summary":"List documents","description":"Quotes, orders and customer invoices from Fortnox, with their lines. An invoice draft (Spiris) is not listed: it has no number yet, and once booked it is listed as the invoice it became. Sorted by `updated_at`, oldest first, then `id`. Page on with `next_cursor`; a record changed while you page comes again on a later page. Removed records are not listed.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"changed_since","in":"query","required":false,"description":"Only records that changed at or after this time (ISO 8601). Removals are not listed.","schema":{"description":"Only records that changed at or after this time (ISO 8601). Removals are not listed.","type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"cursor","in":"query","required":false,"description":"The `next_cursor` of the previous page. Leave it out for the first page.","schema":{"description":"The `next_cursor` of the previous page. Leave it out for the first page.","type":"string","maxLength":200}},{"name":"limit","in":"query","required":false,"description":"Records per page, 1 to 500.","schema":{"default":100,"description":"Records per page, 1 to 500.","type":"integer","minimum":1,"maximum":500}},{"name":"type","in":"query","required":false,"description":"Only documents of this type.","schema":{"description":"Only documents of this type.","type":"string","enum":["quote","order","invoice"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"type":"string","enum":["quote","order","invoice"]},"number":{"type":"string","description":"The document number in Fortnox."},"party_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"The customer’s party, once the customer is synced."},"customer_number":{"type":"string"},"customer_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"currency":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Every amount on the document and its lines."},"exchange_rate":{"anyOf":[{"type":"number"},{"type":"null"}]},"date":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"YYYY-MM-DD."},"due_date":{"anyOf":[{"type":"string"},{"type":"null"}]},"valid_until":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"A quote’s last day."},"delivery_date":{"anyOf":[{"type":"string"},{"type":"null"}]},"settled_date":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The day an invoice was paid in full."},"net_amount":{"anyOf":[{"type":"number"},{"type":"null"}]},"vat_amount":{"anyOf":[{"type":"number"},{"type":"null"}]},"total_amount":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Fortnox computes an order’s totals from what is delivered: 0 until delivery. Read an order’s value from `ordered_net_amount`."},"ordered_net_amount":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"An order’s value excluding VAT, from what was ordered (quantity ordered × price per line). Null on a quote or invoice."},"balance_amount":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"What is left to pay on an invoice."},"vat_included":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"cancelled":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"sent":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"posted":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"An invoice that is bokförd."},"is_credit":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"our_reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"your_reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"your_order_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"lines":{"type":"array","items":{"type":"object","properties":{"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"article_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"The article, when the line names one Aira holds."},"article_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Delivered on an order, invoiced on an invoice, offered on a quote."},"quantity_ordered":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"An order’s ordered quantity: what its value is read from."},"unit":{"anyOf":[{"type":"string"},{"type":"null"}]},"unit_price":{"anyOf":[{"type":"number"},{"type":"null"}]},"discount":{"anyOf":[{"type":"number"},{"type":"null"}]},"discount_type":{"anyOf":[{"type":"string","enum":["percent","amount"]},{"type":"null"}]},"vat_rate":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Percent."},"amount":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The line’s total as Fortnox gives it: including VAT when the document’s `vat_included` is true, and 0 on an undelivered order."},"net_amount":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The line’s total excluding VAT. On an order, from what was ordered. Null when a VAT-inclusive line has no rate."}},"required":["position","article_id","article_number","description","quantity","quantity_ordered","unit","unit_price","discount","discount_type","vat_rate","amount","net_amount"],"additionalProperties":false}},"updated_at":{"type":"string","description":"When the record last changed, UTC with microseconds. Lists sort by it, and `changed_since` compares with it."}},"required":["id","type","number","party_id","customer_number","customer_name","currency","exchange_rate","date","due_date","valid_until","delivery_date","settled_date","net_amount","vat_amount","total_amount","ordered_net_amount","balance_amount","vat_included","cancelled","sent","posted","is_credit","our_reference","your_reference","your_order_number","lines","updated_at"],"additionalProperties":false}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next_cursor"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/documents/{id}":{"get":{"operationId":"getDocument","summary":"Read a document","description":"One quote, order or customer invoice from Fortnox, with its lines. An invoice draft is not one: its id answers 404.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"type":{"type":"string","enum":["quote","order","invoice"]},"number":{"type":"string","description":"The document number in Fortnox."},"party_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"The customer’s party, once the customer is synced."},"customer_number":{"type":"string"},"customer_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"currency":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Every amount on the document and its lines."},"exchange_rate":{"anyOf":[{"type":"number"},{"type":"null"}]},"date":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"YYYY-MM-DD."},"due_date":{"anyOf":[{"type":"string"},{"type":"null"}]},"valid_until":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"A quote’s last day."},"delivery_date":{"anyOf":[{"type":"string"},{"type":"null"}]},"settled_date":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The day an invoice was paid in full."},"net_amount":{"anyOf":[{"type":"number"},{"type":"null"}]},"vat_amount":{"anyOf":[{"type":"number"},{"type":"null"}]},"total_amount":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Fortnox computes an order’s totals from what is delivered: 0 until delivery. Read an order’s value from `ordered_net_amount`."},"ordered_net_amount":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"An order’s value excluding VAT, from what was ordered (quantity ordered × price per line). Null on a quote or invoice."},"balance_amount":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"What is left to pay on an invoice."},"vat_included":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"cancelled":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"sent":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"posted":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"An invoice that is bokförd."},"is_credit":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"our_reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"your_reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"your_order_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"lines":{"type":"array","items":{"type":"object","properties":{"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"article_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"The article, when the line names one Aira holds."},"article_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Delivered on an order, invoiced on an invoice, offered on a quote."},"quantity_ordered":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"An order’s ordered quantity: what its value is read from."},"unit":{"anyOf":[{"type":"string"},{"type":"null"}]},"unit_price":{"anyOf":[{"type":"number"},{"type":"null"}]},"discount":{"anyOf":[{"type":"number"},{"type":"null"}]},"discount_type":{"anyOf":[{"type":"string","enum":["percent","amount"]},{"type":"null"}]},"vat_rate":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Percent."},"amount":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The line’s total as Fortnox gives it: including VAT when the document’s `vat_included` is true, and 0 on an undelivered order."},"net_amount":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The line’s total excluding VAT. On an order, from what was ordered. Null when a VAT-inclusive line has no rate."}},"required":["position","article_id","article_number","description","quantity","quantity_ordered","unit","unit_price","discount","discount_type","vat_rate","amount","net_amount"],"additionalProperties":false}},"updated_at":{"type":"string","description":"When the record last changed, UTC with microseconds. Lists sort by it, and `changed_since` compares with it."}},"required":["id","type","number","party_id","customer_number","customer_name","currency","exchange_rate","date","due_date","valid_until","delivery_date","settled_date","net_amount","vat_amount","total_amount","ordered_net_amount","balance_amount","vat_included","cancelled","sent","posted","is_credit","our_reference","your_reference","your_order_number","lines","updated_at"],"additionalProperties":false}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/agreements":{"get":{"operationId":"listAgreements","summary":"List agreements (avtal)","description":"The agreements in Fortnox's återkommande fakturering, with their rows. Sorted by `updated_at`, oldest first, then `id`. Page on with `next_cursor`; a record changed while you page comes again on a later page. Removed records are not listed.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"changed_since","in":"query","required":false,"description":"Only records that changed at or after this time (ISO 8601). Removals are not listed.","schema":{"description":"Only records that changed at or after this time (ISO 8601). Removals are not listed.","type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"cursor","in":"query","required":false,"description":"The `next_cursor` of the previous page. Leave it out for the first page.","schema":{"description":"The `next_cursor` of the previous page. Leave it out for the first page.","type":"string","maxLength":200}},{"name":"limit","in":"query","required":false,"description":"Records per page, 1 to 500.","schema":{"default":100,"description":"Records per page, 1 to 500.","type":"integer","minimum":1,"maximum":500}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"number":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}],"description":"The agreement’s serial number in Fortnox."},"party_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"The customer’s party, once the customer is synced."},"customer_number":{"type":"string"},"status":{"type":"string","description":"`DRAFT`, `ACTIVE`, `INACTIVE` (paused) or `FINISHED`, as Fortnox says it."},"interval":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"frequency":{"type":"string","description":"`MONTH` or `WEEK`: invoiced every `interval` of these."},"started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"When it was made in Fortnox."},"end_date":{"anyOf":[{"type":"string"},{"type":"null"}]},"next_invoice_date":{"anyOf":[{"type":"string"},{"type":"null"}]},"invoice_handling":{"anyOf":[{"type":"string"},{"type":"null"}]},"currency":{"anyOf":[{"type":"string"},{"type":"null"}]},"period_amount":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"What one invoice comes to, excluding VAT."},"rows":{"type":"array","items":{"type":"object","properties":{"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"type":{"type":"string","description":"`ARTICLE`, `SERVICE` or `TEXT`, as Fortnox says it."},"article_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"anyOf":[{"type":"number"},{"type":"null"}]},"price":{"anyOf":[{"type":"number"},{"type":"null"}]},"discount":{"anyOf":[{"type":"number"},{"type":"null"}]},"vat_rate":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Percent."},"amount":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The row’s total excluding VAT."}},"required":["position","type","article_number","description","quantity","price","discount","vat_rate","amount"],"additionalProperties":false}},"version":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"When Fortnox last changed it, as Aira last read it. Send it with a change, and one Fortnox changed since is refused."},"updated_at":{"type":"string","description":"When the record last changed, UTC with microseconds. Lists sort by it, and `changed_since` compares with it."}},"required":["id","number","party_id","customer_number","status","interval","frequency","started_at","end_date","next_invoice_date","invoice_handling","currency","period_amount","rows","version","updated_at"],"additionalProperties":false}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next_cursor"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/agreements/{id}":{"get":{"operationId":"getAgreement","summary":"Read an agreement (avtal)","description":"One agreement in Fortnox's återkommande fakturering, with its rows.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"number":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}],"description":"The agreement’s serial number in Fortnox."},"party_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"The customer’s party, once the customer is synced."},"customer_number":{"type":"string"},"status":{"type":"string","description":"`DRAFT`, `ACTIVE`, `INACTIVE` (paused) or `FINISHED`, as Fortnox says it."},"interval":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"frequency":{"type":"string","description":"`MONTH` or `WEEK`: invoiced every `interval` of these."},"started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"When it was made in Fortnox."},"end_date":{"anyOf":[{"type":"string"},{"type":"null"}]},"next_invoice_date":{"anyOf":[{"type":"string"},{"type":"null"}]},"invoice_handling":{"anyOf":[{"type":"string"},{"type":"null"}]},"currency":{"anyOf":[{"type":"string"},{"type":"null"}]},"period_amount":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"What one invoice comes to, excluding VAT."},"rows":{"type":"array","items":{"type":"object","properties":{"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"type":{"type":"string","description":"`ARTICLE`, `SERVICE` or `TEXT`, as Fortnox says it."},"article_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"anyOf":[{"type":"number"},{"type":"null"}]},"price":{"anyOf":[{"type":"number"},{"type":"null"}]},"discount":{"anyOf":[{"type":"number"},{"type":"null"}]},"vat_rate":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Percent."},"amount":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The row’s total excluding VAT."}},"required":["position","type","article_number","description","quantity","price","discount","vat_rate","amount"],"additionalProperties":false}},"version":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"When Fortnox last changed it, as Aira last read it. Send it with a change, and one Fortnox changed since is refused."},"updated_at":{"type":"string","description":"When the record last changed, UTC with microseconds. Lists sort by it, and `changed_since` compares with it."}},"required":["id","number","party_id","customer_number","status","interval","frequency","started_at","end_date","next_invoice_date","invoice_handling","currency","period_amount","rows","version","updated_at"],"additionalProperties":false}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/agreements/{id}/cancel":{"post":{"operationId":"cancelAgreement","summary":"Cancel an agreement (avsluta avtal)","description":"Ends an agreement in Fortnox’s återkommande fakturering, as Avsluta does on screen, and answers it as it is after. Judged against the agreement as Fortnox holds it now: one changed in Fortnox since the `version` you send (by default the one Aira last read) is refused with `agreement_changed`, and nothing is written over it; read it again before you retry. A finished or draft agreement is refused with `agreement_not_cancellable`, and any agreement while the company does not use Abonnemang in Aira with `abonnemang_off`. A paused write or a service connection needing re-consent answers 503 with `Retry-After`, and nothing was sent.\n\nScope: `write_fortnox`.","security":[{"apiKey":["write_fortnox"]}],"x-scope":"write_fortnox","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, up to 255 characters. The same key sent again with the same request within a day replays the first success, with `Idempotent-Replayed: true`, instead of writing twice; a refused call keeps nothing, so a corrected one may reuse its key. Sent with a different request after a success it is refused (422).","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"end_date":{"description":"The last day it bills. Before the next period, it ends at once (`FINISHED`); later, it stays in force until then and reads as ending (`ACTIVE` with this `end_date`). By default the last day already invoiced, so it ends at once.","type":"string","format":"date","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"},"version":{"description":"The agreement’s `version` as you read it: refused with `agreement_changed` if Fortnox changed it since. Without it, judged against the version Aira last read.","type":"string","maxLength":40},"reason":{"description":"Why it ends. Kept in Aira only, never sent to Fortnox.","type":"string","maxLength":500}},"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"number":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}],"description":"The agreement’s serial number in Fortnox."},"party_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"The customer’s party, once the customer is synced."},"customer_number":{"type":"string"},"status":{"type":"string","description":"`DRAFT`, `ACTIVE`, `INACTIVE` (paused) or `FINISHED`, as Fortnox says it."},"interval":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"frequency":{"type":"string","description":"`MONTH` or `WEEK`: invoiced every `interval` of these."},"started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"When it was made in Fortnox."},"end_date":{"anyOf":[{"type":"string"},{"type":"null"}]},"next_invoice_date":{"anyOf":[{"type":"string"},{"type":"null"}]},"invoice_handling":{"anyOf":[{"type":"string"},{"type":"null"}]},"currency":{"anyOf":[{"type":"string"},{"type":"null"}]},"period_amount":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"What one invoice comes to, excluding VAT."},"rows":{"type":"array","items":{"type":"object","properties":{"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"type":{"type":"string","description":"`ARTICLE`, `SERVICE` or `TEXT`, as Fortnox says it."},"article_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"anyOf":[{"type":"number"},{"type":"null"}]},"price":{"anyOf":[{"type":"number"},{"type":"null"}]},"discount":{"anyOf":[{"type":"number"},{"type":"null"}]},"vat_rate":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Percent."},"amount":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The row’s total excluding VAT."}},"required":["position","type","article_number","description","quantity","price","discount","vat_rate","amount"],"additionalProperties":false}},"version":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"When Fortnox last changed it, as Aira last read it. Send it with a change, and one Fortnox changed since is refused."},"updated_at":{"type":"string","description":"When the record last changed, UTC with microseconds. Lists sort by it, and `changed_since` compares with it."}},"required":["id","number","party_id","customer_number","status","interval","frequency","started_at","end_date","next_invoice_date","invoice_handling","currency","period_amount","rows","version","updated_at"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The write conflicts with what the book holds; `error.code` says how.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The `Idempotency-Key` was already used for a different request, or Fortnox refused the document; `error.code` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"A service the write needs did not answer, writes to Fortnox are paused, or the service connection needs re-consent; `error.code` says which. See `Retry-After`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/agreements/{id}/rows/{position}":{"patch":{"operationId":"changeAgreementRow","summary":"Change an agreement row’s antal","description":"Sets the antal of one row on an agreement in Fortnox’s återkommande fakturering, as Ändra pris och antal does on screen, keeping its price, and answers the agreement as it is after. Antal 0 is refused: to stop billing, cancel the agreement. Judged against the agreement as Fortnox holds it now: one changed in Fortnox since the `version` you send (by default the one Aira last read) is refused with `agreement_changed`, and nothing is written over it; read it again before you retry. A finished or draft agreement is refused with `agreement_not_changeable`, and any agreement while the company does not use Abonnemang in Aira with `abonnemang_off`. A paused write or a service connection needing re-consent answers 503 with `Retry-After`, and nothing was sent.\n\nScope: `write_fortnox`.","security":[{"apiKey":["write_fortnox"]}],"x-scope":"write_fortnox","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}},{"name":"position","in":"path","required":true,"description":"The row’s `position` on the agreement, as it is read.","schema":{"type":"string","description":"The row’s `position` on the agreement, as it is read."}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, up to 255 characters. The same key sent again with the same request within a day replays the first success, with `Idempotent-Replayed: true`, instead of writing twice; a refused call keeps nothing, so a corrected one may reuse its key. Sent with a different request after a success it is refused (422).","schema":{"type":"string","maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"quantity":{"type":"number","exclusiveMinimum":0,"description":"The row’s antal from now on, more than 0."},"version":{"description":"The agreement’s `version` as you read it: refused with `agreement_changed` if Fortnox changed it since. Without it, judged against the version Aira last read.","type":"string","maxLength":40}},"required":["quantity"],"additionalProperties":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"number":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}],"description":"The agreement’s serial number in Fortnox."},"party_id":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"The customer’s party, once the customer is synced."},"customer_number":{"type":"string"},"status":{"type":"string","description":"`DRAFT`, `ACTIVE`, `INACTIVE` (paused) or `FINISHED`, as Fortnox says it."},"interval":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"frequency":{"type":"string","description":"`MONTH` or `WEEK`: invoiced every `interval` of these."},"started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"When it was made in Fortnox."},"end_date":{"anyOf":[{"type":"string"},{"type":"null"}]},"next_invoice_date":{"anyOf":[{"type":"string"},{"type":"null"}]},"invoice_handling":{"anyOf":[{"type":"string"},{"type":"null"}]},"currency":{"anyOf":[{"type":"string"},{"type":"null"}]},"period_amount":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"What one invoice comes to, excluding VAT."},"rows":{"type":"array","items":{"type":"object","properties":{"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"type":{"type":"string","description":"`ARTICLE`, `SERVICE` or `TEXT`, as Fortnox says it."},"article_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"quantity":{"anyOf":[{"type":"number"},{"type":"null"}]},"price":{"anyOf":[{"type":"number"},{"type":"null"}]},"discount":{"anyOf":[{"type":"number"},{"type":"null"}]},"vat_rate":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Percent."},"amount":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"The row’s total excluding VAT."}},"required":["position","type","article_number","description","quantity","price","discount","vat_rate","amount"],"additionalProperties":false}},"version":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"When Fortnox last changed it, as Aira last read it. Send it with a change, and one Fortnox changed since is refused."},"updated_at":{"type":"string","description":"When the record last changed, UTC with microseconds. Lists sort by it, and `changed_since` compares with it."}},"required":["id","number","party_id","customer_number","status","interval","frequency","started_at","end_date","next_invoice_date","invoice_handling","currency","period_amount","rows","version","updated_at"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The write conflicts with what the book holds; `error.code` says how.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"The `Idempotency-Key` was already used for a different request, or Fortnox refused the document; `error.code` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"A service the write needs did not answer, writes to Fortnox are paused, or the service connection needs re-consent; `error.code` says which. See `Retry-After`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/articles":{"get":{"operationId":"listArticles","summary":"List articles","description":"The articles in Fortnox. Sorted by `updated_at`, oldest first, then `id`. Page on with `next_cursor`; a record changed while you page comes again on a later page. Removed records are not listed.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"changed_since","in":"query","required":false,"description":"Only records that changed at or after this time (ISO 8601). Removals are not listed.","schema":{"description":"Only records that changed at or after this time (ISO 8601). Removals are not listed.","type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"cursor","in":"query","required":false,"description":"The `next_cursor` of the previous page. Leave it out for the first page.","schema":{"description":"The `next_cursor` of the previous page. Leave it out for the first page.","type":"string","maxLength":200}},{"name":"limit","in":"query","required":false,"description":"Records per page, 1 to 500.","schema":{"default":100,"description":"Records per page, 1 to 500.","type":"integer","minimum":1,"maximum":500}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"number":{"type":"string","description":"The article number in Fortnox."},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"unit":{"anyOf":[{"type":"string"},{"type":"null"}]},"sales_price":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"On the default price list."},"purchase_price":{"anyOf":[{"type":"number"},{"type":"null"}]},"currency":{"type":"string","description":"The books’ currency, which both prices are in."},"vat_rate":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Percent."},"active":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"updated_at":{"type":"string","description":"When the record last changed, UTC with microseconds. Lists sort by it, and `changed_since` compares with it."}},"required":["id","number","description","unit","sales_price","purchase_price","currency","vat_rate","active","updated_at"],"additionalProperties":false}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next_cursor"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/articles/{id}":{"get":{"operationId":"getArticle","summary":"Read an article","description":"One article in Fortnox.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"number":{"type":"string","description":"The article number in Fortnox."},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"unit":{"anyOf":[{"type":"string"},{"type":"null"}]},"sales_price":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"On the default price list."},"purchase_price":{"anyOf":[{"type":"number"},{"type":"null"}]},"currency":{"type":"string","description":"The books’ currency, which both prices are in."},"vat_rate":{"anyOf":[{"type":"number"},{"type":"null"}],"description":"Percent."},"active":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"updated_at":{"type":"string","description":"When the record last changed, UTC with microseconds. Lists sort by it, and `changed_since` compares with it."}},"required":["id","number","description","unit","sales_price","purchase_price","currency","vat_rate","active","updated_at"],"additionalProperties":false}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/files":{"get":{"operationId":"listFiles","summary":"List files","description":"The files kept on the company's parties and deals. Sorted by `updated_at`, oldest first, then `id`. Page on with `next_cursor`; a record changed while you page comes again on a later page. Removed records are not listed.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"changed_since","in":"query","required":false,"description":"Only records that changed at or after this time (ISO 8601). Removals are not listed.","schema":{"description":"Only records that changed at or after this time (ISO 8601). Removals are not listed.","type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},{"name":"cursor","in":"query","required":false,"description":"The `next_cursor` of the previous page. Leave it out for the first page.","schema":{"description":"The `next_cursor` of the previous page. Leave it out for the first page.","type":"string","maxLength":200}},{"name":"limit","in":"query","required":false,"description":"Records per page, 1 to 500.","schema":{"default":100,"description":"Records per page, 1 to 500.","type":"integer","minimum":1,"maximum":500}},{"name":"party_id","in":"query","required":false,"description":"Only this party’s files.","schema":{"description":"Only this party’s files.","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},{"name":"deal_id","in":"query","required":false,"description":"Only the files linked to this deal.","schema":{"description":"Only the files linked to this deal.","type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"party_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","description":"The party the file belongs to. A file belongs to exactly one."},"name":{"type":"string","description":"The name it was uploaded or sent with."},"bytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"uploaded_by":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"The member who uploaded it; null for a file from an email."},"created_at":{"type":"string"},"deal_ids":{"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"description":"The party’s deals it is linked to."},"download":{"type":"object","properties":{"url":{"type":"string"},"expires_at":{"type":"string"}},"required":["url","expires_at"],"additionalProperties":false,"description":"A link to the file’s bytes for this key, without the key. It expires at `expires_at`; read the file again for a new one."},"updated_at":{"type":"string","description":"When the record last changed, UTC with microseconds. Lists sort by it, and `changed_since` compares with it."}},"required":["id","party_id","name","bytes","uploaded_by","created_at","deal_ids","download","updated_at"],"additionalProperties":false}},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next_cursor"],"additionalProperties":false}}}},"400":{"description":"A query parameter or the body is invalid; the message names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/files/{id}":{"get":{"operationId":"getFile","summary":"Read a file","description":"One file’s metadata, with a fresh download link.\n\nScope: `read`.","security":[{"apiKey":["read"]}],"x-scope":"read","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"party_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","description":"The party the file belongs to. A file belongs to exactly one."},"name":{"type":"string","description":"The name it was uploaded or sent with."},"bytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"uploaded_by":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}],"description":"The member who uploaded it; null for a file from an email."},"created_at":{"type":"string"},"deal_ids":{"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"description":"The party’s deals it is linked to."},"download":{"type":"object","properties":{"url":{"type":"string"},"expires_at":{"type":"string"}},"required":["url","expires_at"],"additionalProperties":false,"description":"A link to the file’s bytes for this key, without the key. It expires at `expires_at`; read the file again for a new one."},"updated_at":{"type":"string","description":"When the record last changed, UTC with microseconds. Lists sort by it, and `changed_since` compares with it."}},"required":["id","party_id","name","bytes","uploaded_by","created_at","deal_ids","download","updated_at"],"additionalProperties":false}}}},"401":{"description":"No live API key: missing, unknown, revoked, or no longer valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope this operation needs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such record in the company’s book, or none this key’s maker may see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls. See `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/files/{id}/content":{"get":{"operationId":"downloadFile","summary":"Download a file","description":"The file’s bytes, always as `application/octet-stream`. Called with the `download.url` a file read gave, which carries its own authorisation: no API key. An expired link, or one whose key is revoked, answers 404.","parameters":[{"name":"id","in":"path","required":true,"description":"The record’s id.","schema":{"type":"string","description":"The record’s id."}},{"name":"token","in":"query","required":true,"description":"Part of the download link.","schema":{"type":"string"}}],"security":[],"responses":{"200":{"description":"The file’s bytes.","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"404":{"description":"No such file, or a link that no longer opens it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many calls with the key that made the link. See `Retry-After`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}