E039: Link contact to entity
POST /api/contacts/:id/links
Associates an existing contact with a customer, vendor, or other entity. Triggered from Customer Detail or Vendor Detail, "Add contact" with an existing contact.
Authentication
Standard tenant route. Requires Authorization: Bearer <firebase-id-token> and X-Org-Id: <org-id>. Access: Member.
Request
{
"entityType": "customer",
"entityId": "uuid",
"role": "billing",
"isPrimary": true
}
entityType is "customer" or "vendor" (the polymorphic set in v1.0.0).
Response — 201 Created
{
"id": "uuid",
"contactId": "uuid",
"entityType": "customer",
"entityId": "uuid",
"role": "billing",
"isPrimary": true,
"createdAt": "..."
}
Errors
| HTTP | code | Condition |
|---|---|---|
| 404 | not_found | Contact or entity not found. |
| 409 | invalid_transition | Contact already linked to that entity with the same role. |
| 422 | validation_failed | Shape invalid. |
Workflow
Calls W039 Link contact to entity.