BETA

DELETE /branches/{branchRef}

Deletes one of the client's branches.

Resource information
AuthenticationRequired (API Token, Bearer)
Scopeproperty-api-delete
HTTP MethodDELETE
ResponseJSON
Version1

🔴 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 hasWhat happens
2Everything passes to the main branch. There is nothing to choose
3 or moreYou choose with ?targetBranchRef= — if you do not send it, we answer 400 instead of deciding for your client
1It 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
ParameterTypeDescription
branchRefstring (path)Your reference for the branch being deleted. Its numeric Mapaprop branchId also works
targetBranchRefstring (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"
}
FieldTypeDescription
deletedbooleantrue — the branch is gone
deletedInMapapropbooleantrue if it was also deleted in the Mapaprop account. false = it lived only on the ficha
reassignedTonumberThe branchId that received the properties, if you sent a target
scopestringmapaprop or ficha

Errors

CodeWhat happenedWhat to do
400The target is missing (code: TARGET_BRANCH_REQUIRED)The account has 3 or more branches: send ?targetBranchRef=
400The target is not valid (code: INVALID_TARGET_BRANCH)It cannot be the one being deleted nor an agent's branch. Check GET /branches
403The token does not have the property-api-delete scopeIt is a permission on your token: write to us
404That branchRef is not a branch of the client (rule: branch_not_found)The error lists the refs it does have
409It is the account's only branch (code: MUST_HAVE_AT_LEAST_ONE_BRANCH)Create the other one first and then delete this one
409It 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
503We could not delete it at this momentIt is transient and on our side: retry. Nothing was deleted

ℹ️ The agent's 409 is 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.