togglePartnerRole
Requires at least one of the permissions customers:customer:update or suppliers:supplier:update.
Adds a role to a partner that lacks it, or removes it from one that has it. Adding customer or supplier also creates the matching account. The last remaining role cannot be removed. Needs the update permission for each role the partner carries and for the toggled role.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
mutation TogglePartnerRole($id: ID!, $role: PartnerRole!) {
togglePartnerRole(id: $id, role: $role) {
id
code
registrationNumber
name
displayName
legalName
addresses {
id
postalCode
contactName
type
createdAt
city
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation TogglePartnerRole($id: ID!, $role: PartnerRole!) {\n togglePartnerRole(id: $id, role: $role) {\n id\n code\n registrationNumber\n name\n displayName\n legalName\n addresses {\n id\n postalCode\n contactName\n type\n createdAt\n city\n }\n }\n}",
"variables": {
"id": "id",
"role": "CUSTOMER"
}
}
EOF
Variables:
{
"id": "id",
"role": "CUSTOMER"
}
Response:
{
"data": {
"togglePartnerRole": {
"id": "id",
"code": "string",
"registrationNumber": "string",
"name": "string",
"displayName": "string",
"legalName": "string",
"addresses": [
{
"id": "id",
"postalCode": "string",
"contactName": "string",
"type": "string",
"createdAt": "2025-01-15T00:00:00Z",
"city": "string"
}
]
}
}
}
togglePartnerRole(
id: ID!
role: PartnerRole!
): Partner!
Arguments
togglePartnerRole.id ● ID! non-null scalar
The ID of the partner.
togglePartnerRole.role ● PartnerRole! non-null enum
The role to add or remove.
Type
Partner object
A partner: the one master record for customers and vendors, with its roles, addresses, contacts and account details.