users.links.set
Replace every account linked to a user for one source.
To add or remove a single account without sending the full set, use users.links.create or users.links.delete.
Facts
| Method | POST https://api.getdx.com/users.links.set |
| Required scope | users:write |
Arguments
Required arguments
| Name | Type | Description |
|---|---|---|
token |
Token |
Auth token passed as an HTTP header. |
user_id |
Text |
The DX user ID, as returned in id by users.list. |
source |
Text |
The tool the accounts come from. See Sources. |
account_ids |
Array<Text> |
The complete set of account IDs to link for this source, up to 100. Pass [] to unlink every account for the source. |
Usage info
This method requires DX Data Cloud.
The accounts you pass replace the user’s current accounts for that source. Accounts that aren’t in the list are unlinked, and links for other sources are not changed. GitHub and GitLab usernames on the user’s profile are not changed.
If an account is linked to a different user, it moves to this user. If that account was manually linked to the other user, the request fails with manual_link_conflict. Remove the account from the other user first.
Requests for the same user and source run one at a time. If another request for the same user and source is still running after 10 seconds, the request fails with link_update_in_progress. Changes made outside the API, including automatic linking, are not coordinated with API requests, so the most recent write wins.
Sources
| Source | Tool |
|---|---|
ado |
Azure DevOps |
amazon_kiro |
Amazon Kiro |
bitbucket |
Bitbucket Cloud |
bitbucket_server |
Bitbucket Data Center |
claude_code |
Claude Code |
codex |
Codex |
cursor |
Cursor |
github |
GitHub |
gitlab |
GitLab |
jira |
Jira |
linear |
Linear |
windsurf |
Devin Desktop (Windsurf) |
Account IDs
An account ID is the id that users.linkableAccounts.list returns for an imported account. It is the Data Cloud ID of the account, not the ID the tool itself assigns, which that method returns as external_id. In Data Cloud, it is the id column of the source’s users table, such as github_users.id.
Account IDs can change if DX re-imports a connection’s data. Look them up again instead of storing them long term.
Example request
This is a typical request:
curl -X POST https://api.getdx.com/users.links.set \
-H 'Authorization: Bearer xxxx-xxxxxxxxx-xxxx' \
-H 'Content-Type: application/json' \
-d '{
"user_id": "NTEyMDUw",
"source": "github",
"account_ids": ["4812", "4813"]
}'
Example response
This is a typical success response:
{
"ok": true
}
Errors
This table lists the expected errors that this method could return. However, other errors can be returned in the case where the service is down or other unexpected factors affect processing. Callers should always check the value of the ok param in the response.
| Error | Description |
|---|---|
not_authed |
No authentication token provided, or Data Cloud is not enabled for the account. |
not_authorized |
The bearer token does not include users:write. |
not_found |
The user or one of the account IDs was not found. |
User not found in datacloud |
The user has not synced to Data Cloud yet. |
manual_link_conflict |
An account is manually linked to another user. |
link_update_in_progress |
Another request for the same user and source did not finish in time. Retry the request. |
datacloud_unavailable |
Data Cloud did not accept the change. Retry the request. |
Invalid parameter: ... |
source is not supported, or account_ids is not an array of up to 100 positive integers. |
Missing required parameter: user_id |
user_id was not provided. |