{"openapi":"3.1.0","info":{"title":"POST /api/v1/counterparty-aliases","version":"1.0.0","description":"Create or update a counterparty alias"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/counterparty-aliases":{"post":{"tags":["counterparty-aliases"],"summary":"Create or update a counterparty alias","description":"Create a counterparty alias, upserting when one already exists for\nthe same counterparty.\n\nProvide either ``registry_id`` (preferred — applies to every\ntransaction linked to that registry entry) or a raw\n``counterparty_name`` string for unlinked counterparties.","operationId":"create_counterparty_alias_api_v1_counterparty_aliases_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CounterpartyAliasCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_CounterpartyAliasResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"CounterpartyAliasCreate":{"properties":{"registry_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Registry Id","description":"Linked counterparty registry entry. Preferred — the alias then applies to every transaction linked to that entry, surviving raw-string variations."},"counterparty_name":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Counterparty Name","description":"Raw counterparty string to match (case-insensitive) when the counterparty is not linked to the registry. Required when ``registry_id`` is absent."},"display_name":{"type":"string","maxLength":500,"minLength":1,"title":"Display Name","description":"Name to display for this counterparty in this business."}},"type":"object","required":["display_name"],"title":"CounterpartyAliasCreate","description":"Payload to create (or upsert) a counterparty alias."},"CounterpartyAliasResponse":{"properties":{"id":{"type":"string","title":"Id"},"business_id":{"type":"string","title":"Business Id"},"registry_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Registry Id"},"counterparty_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Counterparty Name"},"display_name":{"type":"string","title":"Display Name"},"canonical_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Canonical Name","description":"Canonical registry name the alias overrides, when linked. Display-only hydration; not stored on the alias row."},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","business_id","registry_id","counterparty_name","display_name","created_at","updated_at"],"title":"CounterpartyAliasResponse","description":"Public shape of a counterparty alias."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"SuccessEnvelope_CounterpartyAliasResponse_":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"data":{"anyOf":[{"$ref":"#/components/schemas/CounterpartyAliasResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[CounterpartyAliasResponse]"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}