create_address
Create an address for a customer or supplier. Duplicate addresses return the existing record instead of raising an error.
Instructions
Create an address attached to a customer or supplier.
TOCOnline uses a polymorphic association — the parent is identified
via the addressable_type ("Customer" | "Supplier") and
addressable_id attributes, not a JSON:API relationship.
Returns the created (or, on a duplicate, the existing) address re-fetched by id, so the parent link and all fields are populated — the raw POST echo omits them, which makes the address look empty/unlinked.
TOCOnline enforces a uniqueness constraint on address_detail + postcode
per parent and raises [400] já existe na tabela on a duplicate; this
tool catches that and returns the existing address (idempotent).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| city | Yes | City. | |
| region | No | Region / state. | |
| postcode | No | Postcode / ZIP. | |
| is_primary | No | Whether this is the entity's primary address. | |
| customer_id | No | Attach to a customer. Provide exactly one of customer_id or supplier_id. | |
| supplier_id | No | Attach to a supplier. Provide exactly one of customer_id or supplier_id. | |
| address_detail | Yes | Street / address line. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||