{"openapi":"3.0.0","servers":[{"url":"https://app.abaninja.ch/api/v1/","description":"Production Server"},{"url":"https://app-int.abaninja.ch/api/v1/","description":"Integration Test Server"},{"url":"https://app-test.abaninja.abaservices.ch/api/v1/","description":"Development Server"}],"info":{"title":"AbaNinja Address API (External)","version":"1.0.1","description":"API for manage addresses in AbaNinja\n","license":{"name":"MIT","url":"https://opensource.org/licenses/MIT"},"contact":{"name":"ABACUS Research AG","url":"https://www.abacus.ch","email":"info@abacus.ch"}},"components":{"securitySchemes":{"ninja_auth":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"https://auth-dev.abasky.net/auth/realms/abasky/protocol/openid-connect/auth","tokenUrl":"https://auth-dev.abasky.net/auth/realms/abasky/protocol/openid-connect/token","scopes":{"https://api.abasky.net/auth/abaninja.address":"Scope for accessing address api"}}}}},"responses":{"400":{"description":"error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Access Token expired"},"403":{"description":"Client is not allowed"},"404":{"description":"Not Found"}},"schemas":{"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"]},"Company":{"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/ContactPerson"}},"tags":{"type":"array","items":{"type":"string"}},"contacts":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}},"addresses":{"type":"array","items":{"$ref":"#/components/schemas/Address"}}},"required":["type","uuid","name"]},"ContactPerson":{"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/Contact"}}}},"Person":{"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":"salutations"},"currency_code":{"type":"string"},"language":{"type":"string"},"contacts":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}},"tags":{"type":"array","items":{"type":"string"}},"addresses":{"type":"array","items":{"$ref":"#/components/schemas/Address"}}},"required":["type","uuid","first_name","last_name"]},"Address":{"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"}},"required":["uuid"]},"CompanyBody":{"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/Contact"}},"tags":{"type":"array","items":{"type":"string"}},"contact_persons":{"type":"array","items":{"$ref":"#/components/schemas/ContactPersonBody"}},"addresses":{"type":"array","items":{"$ref":"#/components/schemas/AddressBody"}}},"required":["type","name"]},"ContactPersonBody":{"properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"salutation":{"type":"string","enum":"salutations"},"contacts":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}}},"required":["first_name","last_name"]},"PersonBody":{"type":"object","properties":{"type":{"type":"string","enum":["person"]},"first_name":{"type":"string"},"last_name":{"type":"string"},"salutation":{"type":"string","enum":"salutations"},"currency_code":{"type":"string"},"language":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"contacts":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}},"addresses":{"type":"array","items":{"$ref":"#/components/schemas/AddressBody"}}},"required":["type","first_name","last_name"]},"AddressBody":{"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"}}},"Contact":{"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","is_primary"]},"CompanyList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Company"}},"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"}}}}},"PersonList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Person"}},"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"}}}}}}},"paths":{"/accounts/{account_uuid}/addresses/companies":{"parameters":[{"name":"account_uuid","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","schema":{"type":"string"}}],"get":{"summary":"Get a list of company addresses for given account","security":[{"ninja_auth":["https://api.abasky.net/auth/abaninja.address"]}],"description":"This return a list of available company addresses for the given account","responses":{"200":{"description":"List of Addresses","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompanyList"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"403":{"$ref":"#/components/responses/403"},"404":{"$ref":"#/components/responses/404"}}}},"/accounts/{account_uuid}/addresses/companies/{company_uuid}":{"parameters":[{"name":"account_uuid","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"company_uuid","in":"path","schema":{"type":"string","format":"uuid"},"required":true,"description":"The id of the address"}],"get":{"summary":"Single company access","description":"Returns data for one company only","security":[{"ninja_auth":["https://api.abasky.net/auth/abaninja.address"]}],"responses":{"200":{"description":"Requested company","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Company"}}}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"403":{"$ref":"#/components/responses/403"},"404":{"$ref":"#/components/responses/404"}}},"patch":{"summary":"Single company update","description":"Updates single company","requestBody":{"description":"Addressfields to update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Company"}}}},"security":[{"ninja_auth":["https://api.abasky.net/auth/abaninja.address"]}],"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"}}},"delete":{"summary":"Delete company","security":[{"ninja_auth":["https://api.abasky.net/auth/abaninja.address"]}],"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"}}}},"/accounts/{account_uuid}/addresses/persons":{"parameters":[{"name":"account_uuid","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","schema":{"type":"string"}}],"get":{"summary":"Get a list of person addresses for given account","security":[{"ninja_auth":["https://api.abasky.net/auth/abaninja.address"]}],"description":"This return a list of available company addresses for the given account","responses":{"200":{"description":"List of Addresses","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PersonList"}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"403":{"$ref":"#/components/responses/403"},"404":{"$ref":"#/components/responses/404"}}}},"/accounts/{account_uuid}/addresses/persons/{person_uuid}":{"parameters":[{"name":"account_uuid","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"person_uuid","in":"path","schema":{"type":"string","format":"uuid"},"required":true,"description":"The id of the address"}],"get":{"summary":"Single person access","description":"Returns data for one company only","security":[{"ninja_auth":["https://api.abasky.net/auth/abaninja.address"]}],"responses":{"200":{"description":"Requested address","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Person"}}}}}},"400":{"$ref":"#/components/responses/400"},"401":{"$ref":"#/components/responses/401"},"403":{"$ref":"#/components/responses/403"},"404":{"$ref":"#/components/responses/404"}}},"patch":{"summary":"Single person update","description":"Updates single person","requestBody":{"description":"Addressfields to update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Person"}}}},"security":[{"ninja_auth":["https://api.abasky.net/auth/abaninja.address"]}],"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"}}},"delete":{"summary":"Delete person","security":[{"ninja_auth":["https://api.abasky.net/auth/abaninja.address"]}],"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"}}}},"/accounts/{account_uuid}/addresses/":{"post":{"summary":"Create new address for given account","security":[{"ninja_auth":["https://api.abasky.net/auth/abaninja.address"]}],"description":"Creating a new address in AbaNinja","parameters":[{"name":"account_uuid","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/CompanyBody"},{"$ref":"#/components/schemas/PersonBody"}]}}},"required":true},"responses":{"201":{"description":"Address created","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/Company"},{"$ref":"#/components/schemas/Person"}]}}}},"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/Person"},{"$ref":"#/components/schemas/Company"}]}}}}}}}}}}