{"swagger":"2.0","info":{"title":"AbaNinja Invoice API (External)","version":"1.0.0-ALPHA","description":"API for importing Invoices from third party systems.\n\nThis interface enables a client system to append invoice items to the invoice backlog of an AbaNinja account.\nAll incoming records are to be reviewed and corrected manually.\nThus, invoices will never be sent automatically as a result of a call to this API.\n\nTransferred objects are bound to the AbaNinja account determined by the access token.\n\nMoney amounts and quantities must be specified as strings (format \"decimal\") in order to avoid floating point representation errors directly\nand indirectly by encouraging the use of according numeric type implementations such as BigDecimal in Java.\nThe regex pattern for strings in decimal format would thus be\n\"^(?:\\\\\\\\d+(?:\\\\\\\\.\\\\\\\\d+)?|\\\\\\\\.\\\\\\\\d+)$\"\n\nCurrently supported clients: AbaPOS, PepperShop.\n","termsOfService":"Free access for registered entities, no warranty.\n","license":{"name":"MIT","url":"https://opensource.org/licenses/MIT"},"contact":{"name":"ABACUS Research AG","url":"https://www.abacus.ch","email":"info@abacus.ch"}},"host":"app-test.abaninja.abaservices.ch","schemes":["https"],"produces":["application/json"],"basePath":"/api/v1","securityDefinitions":{"oauth":{"type":"oauth2","flow":"accessCode","tokenUrl":"https://auth-dev.abasky.net/auth/realms/abasky/protocol/openid-connect/token","authorizationUrl":"https://auth-dev.abasky.net/auth/realms/abasky/protocol/openid-connect/auth","scopes":{"https://api.abasky.net/auth/abaninja.profile":"View the AbaNinja profile information","https://api.abasky.net/auth/abaninja.staff":"View information regarding staff in your organizations","https://api.abasky.net/auth/abaninja.timetrack":"View and manage your time tracking data","https://api.abasky.net/auth/abaninja.invoice":"Append invoices to your invoice backlog","https://api.abasky.net/auth/abaninja.product":"View and manage your products"}}},"responses":{"400":{"description":"error","schema":{"$ref":"#/definitions/Error"}},"401":{"description":"Access Token expired"},"403":{"description":"Client is not allowed"},"404":{"description":"Not Found"},"409":{"description":"When transaction is closed"}},"definitions":{"InvoiceStateEnum":{"type":"string","enum":["INBOX","DRAFT","SENDING","SENDFAILED","SENT","ADVISED","VIEWED","PARTIAL","PAID","PAYMENT_REMINDER","FIRST_REMINDER","SECOND_REMINDER","DUE"]},"Invoice":{"type":"object","properties":{"invoice_id":{"type":"string"},"invoice_number":{"type":"string"},"direct_link":{"type":"string"}},"required":["invoice_id","invoice_number","direct_link"]},"InvoiceState":{"type":"object","properties":{"invoice_id":{"type":"string"},"state":{"$ref":"#/definitions/InvoiceStateEnum"}},"required":["invoice_id"]},"InvoiceStateList":{"type":"array","items":{"$ref":"#/definitions/InvoiceState"}},"InvoiceListItem":{"type":"object","properties":{"invoice_id":{"type":"string","format":"uuid"},"invoice_date":{"type":"string","format":"date"},"invoice_number":{"type":"string"},"amount":{"type":"number","format":"float"},"currency_code":{"type":"string","description":"currency code according to ISO 4217"},"state":{"type":"string","enum":"states"},"address":{"type":"object","properties":{"type":{"type":"string","enum":["companies","persons"]},"uuid":{"type":"string","format":"uuid"}}},"payments":{"type":"array","items":{"$ref":"#/definitions/InvoicePayment"}},"pdf_url":{"type":"string"}},"required":["invoice_id","invoice_date","invoice_number","amount","currency_code","state"]},"InvoicePayment":{"type":"object","properties":{"payment_id":{"type":"string","format":"uuid"},"payment_date":{"type":"string","format":"date"},"type":{"type":"string","enum":["Apply Credit","Bank Transfer","Cash","Debit","ACH","Visa Card","MasterCard","American Express","Discover Card","Diners Card","EuroCard","Nova","Credit Card Other","PayPal","Google Wallet","Check","Cashback","Discount","Prepay","Donation","Discount Cash","Partial Payment","BitPay","Cash On Delivery","TWINT","Sofortüberweisung","PostFinance","WIR","Credit"]},"amount":{"type":"number","format":"float"},"currency_code":{"type":"string","description":"currency code according to ISO 4217"}},"required":["payment_id","type","amount","currency_code"]},"InvoiceList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/definitions/InvoiceListItem"}},"links":{"type":"object","properties":{"first":{"type":"string"},"last":{"type":"string"},"prev":{"type":"string"},"next":{"type":"string"}}},"meta":{"type":"object","properties":{"current_page":{"type":"integer","format":"int64"},"from":{"type":"integer","format":"int64"},"last_page":{"type":"integer","format":"int64"},"path":{"type":"string","format":"url"},"per_page":{"type":"integer","format":"int64"},"to":{"type":"integer","format":"int64"},"total":{"type":"integer","format":"int64"}}}}},"ProductGroup":{"type":"object","properties":{"product_group_id":{"type":"string"},"product_group_description":{"type":"string"}}},"Product":{"type":"object","properties":{"product_id":{"type":"string"},"product_name":{"type":"string"},"product_description":{"type":"string"},"product_cost":{"type":"number","format":"double"},"product_tax_rate":{"type":"number","format":"double"},"is_inclusive":{"type":"boolean","default":false},"product_group":{"$ref":"#/definitions/ProductGroup"}},"required":["product_id","product_name"]},"ProductList":{"type":"array","items":{"$ref":"#/definitions/Product"}},"Company":{"type":"object","properties":{"uuid":{"type":"string","format":"uuid"},"email":{"type":"string"},"name":{"type":"string"},"subject_to_vat":{"type":"boolean"},"vat_number":{"type":"string"},"prices_inclusive":{"type":"boolean"},"agb_accepted":{"type":"boolean"},"language":{"type":"string"},"street":{"type":"string"},"addition":{"type":"string"},"postal_code":{"type":"string"},"city":{"type":"string"},"country":{"type":"string"}}},"CompanyList":{"type":"array","items":{"$ref":"#/definitions/Company"},"example":[{"uuid":"a117f29c-bc4a-4b57-9ce4-0cd631c16e2c","name":"Rialto User","email":"rialtodev@abacus.ch","subject_to_vat":true,"vat_number":"CHE-123.456.789 MWST","prices_inclusive":true,"agb_accepted":true,"language":"de","street":"Musterstrasse 1","addition":"Postfach","postal_code":"1234","city":"Musterhausen","country":"CH"}]},"User":{"type":"object","properties":{"email":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"}}},"Error":{"type":"object","properties":{"error":{"type":"string","description":"A single ASCII error code\n"},"error_description":{"type":"string","description":"Human-readable ASCII text providing\nadditional information, used to assist the client developer in\nunderstanding the error that occurred.\n"}},"required":["error"]}},"paths":{"/user":{"get":{"produces":["application/json"],"security":[{"oauth":["https://api.abasky.net/auth/abaninja.profile"]}],"responses":{"200":{"description":"User Object","schema":{"$ref":"#/definitions/User"}},"400":{"$ref":"#/responses/400"},"401":{"$ref":"#/responses/401"},"403":{"$ref":"#/responses/403"}}}},"/companies":{"get":{"produces":["application/json"],"security":[{"oauth":["https://api.abasky.net/auth/abaninja.profile"]}],"responses":{"200":{"description":"Company List","schema":{"$ref":"#/definitions/CompanyList"}},"400":{"$ref":"#/responses/400"},"401":{"$ref":"#/responses/401"},"403":{"$ref":"#/responses/403"}}}},"/invoices":{"get":{"produces":["application/json"],"security":[{"oauth":["https://api.abasky.net/auth/abaninja.invoice"]}],"parameters":[{"name":"X-Company-Id","in":"header","required":true,"type":"string","description":"Id of company where the invoices should be queried"},{"name":"updated_since","in":"query","type":"string","format":"date"},{"name":"limit","in":"query","type":"integer","format":"int32"},{"name":"page","in":"query","type":"integer","format":"int64"}],"responses":{"200":{"description":"Invoice list","schema":{"$ref":"#/definitions/InvoiceList"}},"400":{"$ref":"#/responses/400"},"401":{"$ref":"#/responses/401"},"403":{"$ref":"#/responses/403"}}}},"/import/invoices":{"post":{"consumes":["text/xml"],"parameters":[{"name":"X-Attachment-Count","in":"header","required":false,"type":"integer","description":"Number of Attachments to Upload. Default: 0"},{"name":"X-Company-Id","in":"header","required":true,"type":"string","description":"Id of company where the invoice should be imported to"},{"name":"document","in":"body","required":true,"schema":{"type":"string"},"description":"Invoice in ZUGFeRD Format"}],"summary":"Send Invoice Data for Import as ZUGFeRD to AbaNinja.","security":[{"oauth":["https://api.abasky.net/auth/abaninja.invoice"]}],"responses":{"201":{"description":"Invoice ID","schema":{"$ref":"#/definitions/Invoice"}},"400":{"$ref":"#/responses/400"},"401":{"$ref":"#/responses/401"},"403":{"$ref":"#/responses/403"}}}},"/import/invoices/upload":{"post":{"consumes":["application/pdf"],"parameters":[{"name":"X-Attachment-Count","in":"header","required":false,"type":"integer","description":"Number of Attachments to Upload. Default: 0"},{"name":"X-Company-Id","in":"header","required":true,"type":"string","description":"Id of company where the invoice should be imported to"},{"name":"document","in":"body","required":true,"schema":{"type":"string","format":"binary"},"description":"Invoice as PDF with ZUGFeRD XML as attachment"}],"summary":"Upload PDF Invoice.","security":[{"oauth":["https://api.abasky.net/auth/abaninja.invoice"]}],"responses":{"201":{"description":"Invoice ID and UUID for Attachment Upload when needed","schema":{"$ref":"#/definitions/Invoice"}},"400":{"$ref":"#/responses/400"},"401":{"$ref":"#/responses/401"},"403":{"$ref":"#/responses/403"}}}},"/invoices/{invoice_id}/state":{"get":{"summary":"Get State of Invoice(s)\n","consumes":["application/json"],"parameters":[{"name":"invoice_id","in":"path","required":true,"type":"string","description":"ID(s) of invoice(s) to check.\nMultiple IDs have to be separated with semicolon (;)\n"},{"name":"X-Company-Id","in":"header","required":true,"type":"string","description":"Id of company where the invoice should be imported to"}],"security":[{"oauth":["https://api.abasky.net/auth/abaninja.invoice"]}],"responses":{"200":{"description":"List of States for all requested ids","schema":{"$ref":"#/definitions/InvoiceStateList"}},"400":{"$ref":"#/responses/400"},"401":{"$ref":"#/responses/401"},"403":{"$ref":"#/responses/403"},"404":{"$ref":"#/responses/404"}}}},"/invoices/{invoice_id}":{"patch":{"consumes":["application/x-www-form-urlencoded"],"summary":"Update fields of invoice. (Currently only State)\n","parameters":[{"name":"invoice_id","in":"path","type":"string","required":true,"description":"Id of Invoice to update"},{"name":"X-Company-Id","in":"header","required":true,"type":"string","description":"Id of company where the invoice exists in"},{"name":"state","in":"formData","type":"string","enum":["DRAFT","SENT","MARK_SENT","PAID"]}],"security":[{"oauth":["https://api.abasky.net/auth/abaninja.invoice"]}],"responses":{"200":{"description":"Invoice successfully updated"},"400":{"$ref":"#/responses/400"},"401":{"$ref":"#/responses/401"},"403":{"$ref":"#/responses/403"},"404":{"description":"invoice_id not found"}}}},"/attachments/{invoice_id}":{"post":{"summary":"Add File as attachment to Invoice\n","consumes":["application/pdf","image/png","image/jpeg"],"parameters":[{"name":"invoice_id","in":"path","required":true,"type":"string","description":"Invoice ID which documents should be attached to."},{"name":"X-Company-Id","in":"header","required":true,"type":"string","description":"Id of company where the invoice should be imported to"},{"name":"attachment","in":"body","required":true,"description":"File to upload as an attachment to invoice.\n\nAllowed are PDF and pictures in PNG or JPEG Format \n","schema":{"type":"string","format":"binary"}}],"security":[{"oauth":["https://api.abasky.net/auth/abaninja.invoice"]}],"responses":{"201":{"description":"Attachment upload successfully"},"400":{"$ref":"#/responses/400"},"401":{"$ref":"#/responses/401"},"403":{"$ref":"#/responses/403"},"404":{"$ref":"#/responses/404"},"409":{"$ref":"#/responses/409"}}}},"/products":{"get":{"summary":"Get List of all available products\n","produces":["application/json"],"parameters":[{"name":"X-Company-Id","in":"header","required":true,"type":"string","description":"Id of company where the invoice should be imported to"}],"security":[{"oauth":["https://api.abasky.net/auth/abaninja.product"]}],"responses":{"200":{"schema":{"$ref":"#/definitions/ProductList"},"description":"List of products"},"400":{"$ref":"#/responses/400"},"401":{"$ref":"#/responses/401"},"403":{"$ref":"#/responses/403"},"404":{"$ref":"#/responses/404"}}},"post":{"summary":"Add new Products. Imports all or nothing (on error case)\n","parameters":[{"name":"products","in":"body","required":true,"schema":{"$ref":"#/definitions/ProductList"}},{"name":"X-Overwrite-Existing","in":"header","required":false,"type":"boolean","description":"When true, deletes all existing products in AbaNinja, otherwise Products will be merged.\nDefault: false\n"},{"name":"X-Company-Id","in":"header","required":true,"type":"string","description":"Id of company"}],"security":[{"oauth":["https://api.abasky.net/auth/abaninja.product"]}],"responses":{"200":{"description":"Products successfully imported"},"400":{"$ref":"#/responses/400"},"401":{"$ref":"#/responses/401"},"403":{"$ref":"#/responses/403"},"404":{"$ref":"#/responses/404"}}}},"/products/{product_id}":{"get":{"summary":"Get single product\n","parameters":[{"name":"product_id","in":"path","required":true,"type":"string"},{"name":"X-Company-Id","in":"header","required":true,"type":"string","description":"Id of company"}],"security":[{"oauth":["https://api.abasky.net/auth/abaninja.product"]}],"responses":{"200":{"schema":{"$ref":"#/definitions/Product"},"description":"OK"},"400":{"$ref":"#/responses/400"},"401":{"$ref":"#/responses/401"},"403":{"$ref":"#/responses/403"},"404":{"$ref":"#/responses/404"}}}},"/analytics/sales/{company_id}":{"post":{"consumes":["application/pdf","text/xml"],"summary":"Add sales data to AbaNinja.\nDon't include data which are given by the /import/invoices or /import/invoices/upload endpoint. otherwise the data is count twice\n","parameters":[{"name":"company_id","in":"path","required":true,"type":"string"},{"name":"document","in":"body","required":true,"schema":{"type":"string","format":"binary"},"description":"ZUGFeRD XML or PDF with ZUGFeRD attached"}],"security":[{"oauth":["https://api.abasky.net/auth/abaninja.invoice"]}],"responses":{"200":{"description":"Data imported"},"400":{"$ref":"#/responses/400"},"401":{"$ref":"#/responses/401"},"403":{"$ref":"#/responses/403"},"404":{"$ref":"#/responses/404"}}}}}}