Skip to content

Merge a client into another

POST
/clients/{id}/merge
Code sample: Shell / cURL
curl --request POST \
--url https://example.com/api/v1/clients/example/merge \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "confirm": true, "targetClientId": "example" }'

Re-points every relation of client {id} (projects, orders, invoices, estimates, tasks, contacts, tags, direct access, responsibles, teams, roles, custom field values, commissions, referrals, affiliate link, order form submissions, resources, impersonations, import mappings) onto targetClientId in one transaction, then deletes client {id}. Where a unique constraint would collide the target’s row wins, and a person on both clients blocks the merge; referrals between the two clients are dropped. Responsibles are combined by member, retaining an existing target assignment. Access and responsibility counts are reported separately as directAccess and responsibles. The target keeps its name — rename it afterwards with PATCH /clients/{id}. When 1Password is connected, the 1Password groups of the teams that moved get access to the target’s vault in the background; the source’s vault link goes away with it and the vault stays in 1Password. Cannot be undone. Requires the clients.edit permission.

id
required

Resource identifier (CUID2).

string
>= 1 characters

Resource identifier (CUID2).

Media typeapplication/json
object
confirm
required

Must be true — the merge deletes the source client and cannot be undone.

boolean
targetClientId
required

The client that survives; every relation of the merged client moves onto it.

string
>= 1 characters

What the merge moved and dropped.

Media typeapplication/json
object
data
required

What merging one client into another moves, drops and leaves a remark about.

object
dropped
required

Rows discarded because the target already holds an equivalent.

object
affiliateLinks
required
integer
>= -9007199254740991 <= 9007199254740991
directAccess
required
integer
>= -9007199254740991 <= 9007199254740991
fieldValues
required
integer
>= -9007199254740991 <= 9007199254740991
referrals
required
integer
>= -9007199254740991 <= 9007199254740991
responsibles
required
integer
>= -9007199254740991 <= 9007199254740991
roles
required
integer
>= -9007199254740991 <= 9007199254740991
tags
required
integer
>= -9007199254740991 <= 9007199254740991
teams
required
integer
>= -9007199254740991 <= 9007199254740991
moved
required

Rows re-pointed from the source client to the target, per relation.

object
affiliateLinks
required
integer
>= -9007199254740991 <= 9007199254740991
commissions
required
integer
>= -9007199254740991 <= 9007199254740991
contacts
required
integer
>= -9007199254740991 <= 9007199254740991
deals
required
integer
>= -9007199254740991 <= 9007199254740991
directAccess
required
integer
>= -9007199254740991 <= 9007199254740991
estimates
required
integer
>= -9007199254740991 <= 9007199254740991
fieldValues
required
integer
>= -9007199254740991 <= 9007199254740991
impersonations
required
integer
>= -9007199254740991 <= 9007199254740991
importMappings
required
integer
>= -9007199254740991 <= 9007199254740991
invoices
required
integer
>= -9007199254740991 <= 9007199254740991
orderFormSubmissions
required
integer
>= -9007199254740991 <= 9007199254740991
orders
required
integer
>= -9007199254740991 <= 9007199254740991
paymentRequests
required
integer
>= -9007199254740991 <= 9007199254740991
projects
required
integer
>= -9007199254740991 <= 9007199254740991
referralCommissions
required
integer
>= -9007199254740991 <= 9007199254740991
referralsMade
required
integer
>= -9007199254740991 <= 9007199254740991
referralsReceived
required
integer
>= -9007199254740991 <= 9007199254740991
resources
required
integer
>= -9007199254740991 <= 9007199254740991
responsibles
required
integer
>= -9007199254740991 <= 9007199254740991
roles
required
integer
>= -9007199254740991 <= 9007199254740991
tags
required
integer
>= -9007199254740991 <= 9007199254740991
tasks
required
integer
>= -9007199254740991 <= 9007199254740991
tasksCreated
required
integer
>= -9007199254740991 <= 9007199254740991
teams
required
integer
>= -9007199254740991 <= 9007199254740991
notes
required

Remarks about conflict resolutions worth reading before merging.

Array<string>
source
required
object
id
required
string
name
required
string
target
required
object
id
required
string
name
required
string

Example generated

{
"data": {
"dropped": {
"affiliateLinks": 1,
"directAccess": 1,
"fieldValues": 1,
"referrals": 1,
"responsibles": 1,
"roles": 1,
"tags": 1,
"teams": 1
},
"moved": {
"affiliateLinks": 1,
"commissions": 1,
"contacts": 1,
"deals": 1,
"directAccess": 1,
"estimates": 1,
"fieldValues": 1,
"impersonations": 1,
"importMappings": 1,
"invoices": 1,
"orderFormSubmissions": 1,
"orders": 1,
"paymentRequests": 1,
"projects": 1,
"referralCommissions": 1,
"referralsMade": 1,
"referralsReceived": 1,
"resources": 1,
"responsibles": 1,
"roles": 1,
"tags": 1,
"tasks": 1,
"tasksCreated": 1,
"teams": 1
},
"notes": [
"example"
],
"source": {
"id": "example",
"name": "example"
},
"target": {
"id": "example",
"name": "example"
}
}
}

Validation error. Parse failures include field paths and expectations.

Media typeapplication/json

Validation error with safe field paths and expected values; submitted values are never returned.

object
error
required
object
code
required

Stable machine-readable error code.

string
issues
Array<object>
object
expected
required
string
message
required
string
path
required
Array<string | number>
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Unauthorized.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Forbidden.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Source or target client not found in this workspace.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Conflict.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

The target is the source itself, or is archived.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Rate limit exceeded. Wait for Retry-After before retrying.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}
RateLimit-Limit
string
/^\d+$/

Maximum requests in the current quota window.

RateLimit-Policy
string

Quota policy in requests and window seconds, for example 60;w=60.

RateLimit-Remaining
string
/^\d+$/

Requests left in this quota window (zero when blocked).

RateLimit-Reset
string
/^\d+$/

Seconds until the current quota window resets, when available from the rate-limit store.

Retry-After
string
/^\d+$/

Seconds until another request may be attempted.