DELETE /branches/{branchRef}
Deletes one of the client's branches.
| Resource information | |
|---|---|
| Authentication | Required (API Token, Bearer) |
| Scope | property-api-delete |
| HTTP Method | DELETE |
| Response | JSON |
| Version | 1 |
🔴 It is not just removing it from a list
If the branch exists in the client's Mapaprop account, deleting it moves things: its properties, contacts, signs and users pass to another branch. That cannot be undone.
| How many branches the account has | What happens |
|---|---|
| 2 | Everything passes to the main branch. There is nothing to choose |
| 3 or more | You choose with ?targetBranchRef= — if you do not send it, we answer 400 instead of deciding for your client |
| 1 | It cannot be deleted: an account cannot be left with no branches |
If the branch lives only on the ficha (your client has no Mapaprop account), the entry is removed and there is nothing to reassign.
The call
DELETE https://property-api.mapaprop.com/property-v1/branches/centro
Authorization: Bearer {access_token}
x-client-ref: {your client reference}
With a target, when the account has three or more branches:
DELETE https://property-api.mapaprop.com/property-v1/branches/centro?targetBranchRef=casa-central
| Parameter | Type | Description |
|---|---|---|
branchRef | string (path) | Your reference for the branch being deleted. Its numeric Mapaprop branchId also works |
targetBranchRef | string (query) | The branch that keeps the properties, the contacts and the signs. Required with 3 or more branches |
The response
{
"branchRef": "centro",
"mapapropBranchId": 12122,
"deleted": true,
"deletedInMapaprop": true,
"reassignedTo": 1,
"scope": "mapaprop"
}
| Field | Type | Description |
|---|---|---|
deleted | boolean | true — the branch is gone |
deletedInMapaprop | boolean | true if it was also deleted in the Mapaprop account. false = it lived only on the ficha |
reassignedTo | number | The branchId that received the properties, if you sent a target |
scope | string | mapaprop or ficha |
Errors
| Code | What happened | What to do |
|---|---|---|
400 | The target is missing (code: TARGET_BRANCH_REQUIRED) | The account has 3 or more branches: send ?targetBranchRef= |
400 | The target is not valid (code: INVALID_TARGET_BRANCH) | It cannot be the one being deleted nor an agent's branch. Check GET /branches |
403 | The token does not have the property-api-delete scope | It is a permission on your token: write to us |
404 | That branchRef is not a branch of the client (rule: branch_not_found) | The error lists the refs it does have |
409 | It is the account's only branch (code: MUST_HAVE_AT_LEAST_ONE_BRANCH) | Create the other one first and then delete this one |
409 | It is an agent's branch (code: CANNOT_DELETE_AGENT_BRANCH) | It is taken down from the agent's user, in Mapaprop. There is no way to do it through the API yet |
503 | We could not delete it at this moment | It is transient and on our side: retry. Nothing was deleted |
ℹ️ The agent's
409is not solved by retrying. An agent's branch is tied to their user: it is released when that user is deactivated, and that is done in Mapaprop. It is a rule of the account, not a problem with your call.
Related
- Edit a branch
- GET /branches — the account's branches, with their
branchId - PUT /customers — declare the branches on the ficha