{"openapi":"3.1.0","info":{"title":"AbaNinja Addresses API","version":"2.0.4","x-domain-id":"addresses"},"servers":[{"url":"https://api.abaninja.ch","description":"The AbaNinja API server"}],"security":[{"ApiToken":[]}],"tags":[{"name":"Addresses","description":"Manage addresses"}],"paths":{"/accounts/{accountUuid}/addresses/v2/addresses":{"post":{"summary":"Create new address for given account","description":"Creating a new address in AbaNinja","tags":["Addresses"],"parameters":[{"name":"accountUuid","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"force","in":"query","description":"Force saving of Address. Even when duplicates were found. Default: false\n","schema":{"type":"boolean"}}],"requestBody":{"description":"New Address","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/AddressesCompanyBody"},{"$ref":"#/components/schemas/AddressesPersonBody"}]}}},"required":true},"responses":{"201":{"description":"Address created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"oneOf":[{"$ref":"#/components/schemas/AddressesCompany"},{"$ref":"#/components/schemas/AddressesPerson"}]}}}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"403":{"$ref":"#/components/responses/403"},"404":{"$ref":"#/components/responses/404"},"409":{"description":"Address duplicates found","content":{"application/json":{"schema":{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/AddressesPerson"},{"$ref":"#/components/schemas/AddressesCompany"}]}}}}}},"operationId":"addresses_create_addresses"}},"/accounts/{accountUuid}/addresses/v2/check-customer-number":{"get":{"summary":"Check if the customerNumber already in use or not","tags":["Addresses"],"responses":{"200":{"description":"This customer number is currently not in use"},"400":{"description":"This customer number is already in use"}},"parameters":[{"name":"accountUuid","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"customerNumber","description":"The customer number to check","required":true,"in":"query","schema":{"type":"string"}},{"name":"addressUuid","in":"query","description":"The address UUID to ignore for this check","schema":{"type":"string","format":"uuid"}}],"operationId":"addresses_list_check_customer_number"}},"/accounts/{accountUuid}/addresses/v2/companies":{"get":{"summary":"Get a list of company addresses for given account","description":"This return a list of available company addresses for the given account","tags":["Addresses"],"responses":{"200":{"description":"List of Addresses","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddressesCompanies"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"403":{"$ref":"#/components/responses/403"},"404":{"$ref":"#/components/responses/404"}},"parameters":[{"name":"accountUuid","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"page","in":"query","schema":{"type":"integer","format":"int64"}},{"name":"limit","in":"query","schema":{"type":"integer","format":"int64"}},{"name":"tags[]","in":"query","explode":true,"style":"form","schema":{"type":"array","items":{"type":"string"}}}],"operationId":"addresses_list_companies"}},"/accounts/{accountUuid}/addresses/v2/persons":{"get":{"summary":"Get a list of person addresses for given account","description":"This return a list of available company addresses for the given account","tags":["Addresses"],"responses":{"200":{"description":"List of Addresses","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddressesPersons"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"403":{"$ref":"#/components/responses/403"},"404":{"$ref":"#/components/responses/404"}},"parameters":[{"name":"accountUuid","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"page","in":"query","schema":{"type":"integer","format":"int64"}},{"name":"limit","in":"query","schema":{"type":"integer","format":"int64"}},{"name":"tags[]","in":"query","style":"form","explode":true,"schema":{"type":"array","items":{"type":"string"}}}],"operationId":"addresses_list_persons"}},"/accounts/{accountUuid}/addresses/v2/companies/{companyUuid}":{"get":{"summary":"Single company","description":"Returns data for one company only","tags":["Addresses"],"responses":{"200":{"description":"Requested company","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AddressesCompany"}}}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"403":{"$ref":"#/components/responses/403"},"404":{"$ref":"#/components/responses/404"}},"parameters":[{"name":"accountUuid","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"companyUuid","in":"path","schema":{"type":"string","format":"uuid"},"required":true,"description":"The id of the address"}],"operationId":"addresses_get_companies"},"patch":{"summary":"Single company update","description":"Updates single company","tags":["Addresses"],"requestBody":{"description":"Addressfields to update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddressesCompany"}}}},"responses":{"200":{"description":"Address updated"},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"403":{"$ref":"#/components/responses/403"},"404":{"$ref":"#/components/responses/404"}},"parameters":[{"name":"accountUuid","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"companyUuid","in":"path","schema":{"type":"string","format":"uuid"},"required":true,"description":"The id of the address"}],"operationId":"addresses_update_companies"},"delete":{"summary":"Delete company","tags":["Addresses"],"responses":{"200":{"description":"Company deleted"},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"403":{"$ref":"#/components/responses/403"},"404":{"$ref":"#/components/responses/404"},"409":{"description":"Company not deleted. Is in use"}},"parameters":[{"name":"accountUuid","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"companyUuid","in":"path","schema":{"type":"string","format":"uuid"},"required":true,"description":"The id of the address"}],"operationId":"addresses_delete_companies"}},"/accounts/{accountUuid}/addresses/v2/persons/{personUuid}":{"get":{"summary":"Single person access","description":"Returns data for one company only","tags":["Addresses"],"responses":{"200":{"description":"Requested address","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AddressesPerson"}}}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"403":{"$ref":"#/components/responses/403"},"404":{"$ref":"#/components/responses/404"}},"parameters":[{"name":"accountUuid","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"personUuid","in":"path","schema":{"type":"string","format":"uuid"},"required":true}],"operationId":"addresses_get_persons"},"patch":{"summary":"Single person update","description":"Updates single person","tags":["Addresses"],"requestBody":{"description":"Addressfields to update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddressesPerson"}}}},"responses":{"200":{"description":"Address updated"},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"403":{"$ref":"#/components/responses/403"},"404":{"$ref":"#/components/responses/404"}},"parameters":[{"name":"accountUuid","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"personUuid","in":"path","schema":{"type":"string","format":"uuid"},"required":true}],"operationId":"addresses_update_persons"},"delete":{"summary":"Delete person","tags":["Addresses"],"responses":{"200":{"description":"Person deleted"},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"403":{"$ref":"#/components/responses/403"},"404":{"$ref":"#/components/responses/404"},"409":{"description":"Person not deleted. Is in use"}},"parameters":[{"name":"accountUuid","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"personUuid","in":"path","schema":{"type":"string","format":"uuid"},"required":true}],"operationId":"addresses_delete_persons"}}},"components":{"securitySchemes":{"ApiToken":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer token authentication. Create tokens in Settings > API Token."}},"schemas":{"AddressesContact":{"type":"object","properties":{"type":{"type":"string","enum":["email","phone","mobile","fax","website","pager","skype","twitter"]},"value":{"type":"string"},"is_primary":{"type":"boolean"}},"required":["type","value","primary"]},"AddressesContactBody":{"type":"object","properties":{"type":{"type":"string","enum":["email","phone","mobile","fax","website","pager","skype","twitter"]},"value":{"type":"string"},"primary":{"type":"boolean"}},"required":["type","value","primary"]},"AddressesContactPerson":{"type":"object","properties":{"uuid":{"type":"string","format":"uuid"},"first_name":{"type":"string"},"last_name":{"type":"string"},"salutation":{"type":"string","enum":["Mr","Ms","Family"]},"contacts":{"type":"array","items":{"$ref":"#/components/schemas/AddressesContact"}}}},"AddressesAddress":{"type":"object","properties":{"uuid":{"type":"string","format":"uuid"},"address":{"type":"string"},"street_number":{"type":"string"},"extension":{"type":"string"},"additional_field":{"type":"string"},"city":{"type":"string"},"zip_code":{"type":"string"},"country_code":{"type":"string"},"state":{"type":"string"}},"required":["uuid"]},"AddressesCompany":{"type":"object","properties":{"type":{"type":"string","enum":["company"]},"uuid":{"type":"string","format":"uuid"},"customer_number":{"type":"string"},"name":{"type":"string"},"id_number":{"type":"string"},"vat_number":{"type":"string"},"currency_code":{"type":"string"},"language":{"type":"string"},"contact_persons":{"type":"array","items":{"$ref":"#/components/schemas/AddressesContactPerson"}},"tags":{"type":"array","items":{"type":"string"}},"contacts":{"type":"array","items":{"$ref":"#/components/schemas/AddressesContact"}},"addresses":{"type":"array","items":{"$ref":"#/components/schemas/AddressesAddress"}},"private_notes":{"type":"string"},"automatic_dunning":{"type":"boolean"},"payment_terms":{"type":"integer","enum":[-1,7,10,14,15,20,30,60,90]}},"required":["type","uuid","name"]},"AddressesCompanies":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AddressesCompany"}},"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"}}}}},"AddressesPerson":{"type":"object","properties":{"type":{"type":"string","enum":["person"]},"uuid":{"type":"string","format":"uuid"},"first_name":{"type":"string"},"last_name":{"type":"string"},"salutation":{"type":"string","enum":["Mr","Ms","Family"]},"currency_code":{"type":"string"},"language":{"type":"string"},"contacts":{"type":"array","items":{"$ref":"#/components/schemas/AddressesContact"}},"tags":{"type":"array","items":{"type":"string"}},"addresses":{"type":"array","items":{"$ref":"#/components/schemas/AddressesAddress"}},"private_notes":{"type":"string"},"automatic_dunning":{"type":"boolean"},"payment_terms":{"type":"integer","enum":[-1,7,10,14,15,20,30,60,90]}},"required":["type","uuid","first_name","last_name"]},"AddressesPersons":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AddressesPerson"}},"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"}}}}},"AddressesContactPersonBody":{"properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"salutation":{"type":"string","enum":["Mr","Ms","Family"]},"contacts":{"type":"array","items":{"$ref":"#/components/schemas/AddressesContactBody"}}},"required":["first_name","last_name","salutation"]},"AddressesAddressBody":{"type":"object","properties":{"address":{"type":"string"},"street_number":{"type":"string"},"extension":{"type":"string"},"additional_field":{"type":"string"},"city":{"type":"string"},"zip_code":{"type":"string"},"country_code":{"type":"string"},"state":{"type":"string"}}},"AddressesCompanyBody":{"type":"object","properties":{"type":{"type":"string","enum":["company"]},"customer_number":{"type":"string"},"name":{"type":"string"},"id_number":{"type":"string"},"vat_number":{"type":"string"},"currency_code":{"type":"string"},"language":{"type":"string"},"contacts":{"type":"array","items":{"$ref":"#/components/schemas/AddressesContactBody"}},"tags":{"type":"array","items":{"type":"string"}},"contact_persons":{"type":"array","items":{"$ref":"#/components/schemas/AddressesContactPersonBody"}},"addresses":{"type":"array","items":{"$ref":"#/components/schemas/AddressesAddressBody"}},"private_notes":{"type":"string"},"automatic_dunning":{"type":"boolean"},"payment_terms":{"type":"integer","enum":[-1,7,10,14,15,20,30,60,90]}},"required":["type","name"]},"AddressesPersonBody":{"type":"object","properties":{"type":{"type":"string","enum":["person"]},"first_name":{"type":"string"},"last_name":{"type":"string"},"salutation":{"type":"string","enum":["Mr","Ms","Family"]},"currency_code":{"type":"string"},"language":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"contacts":{"type":"array","items":{"$ref":"#/components/schemas/AddressesContactBody"}},"addresses":{"type":"array","items":{"$ref":"#/components/schemas/AddressesAddressBody"}},"private_notes":{"type":"string"},"automatic_dunning":{"type":"boolean"},"payment_terms":{"type":"integer","enum":[-1,7,10,14,15,20,30,60,90]}},"required":["type","first_name","last_name","salutation"]},"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"]}},"responses":{"400":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Access Token expired"},"403":{"description":"Client / Token is not allowed"},"404":{"description":"Not Found"}}}}