curl --request PATCH \
--url https://app.chainpatrol.io/api/v2/organization/assets/{assetId} \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "<string>",
"description": "<string>",
"groupId": 1
}
'{
"id": 123,
"content": "<string>",
"name": "<string>",
"description": "<string>",
"groupId": 123
}Update an asset’s name, description, or group assignment. The asset must belong to your organization.
curl --request PATCH \
--url https://app.chainpatrol.io/api/v2/organization/assets/{assetId} \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "<string>",
"description": "<string>",
"groupId": 1
}
'{
"id": 123,
"content": "<string>",
"name": "<string>",
"description": "<string>",
"groupId": 123
}X-API-KEY header:
X-API-KEY: your_api_key_here
const response = await fetch(
"https://app.chainpatrol.io/api/v2/organization/assets/12345",
{
method: "PATCH",
headers: {
"Content-Type": "application/json",
"X-API-KEY": "YOUR_API_KEY_HERE",
},
body: JSON.stringify({
assetId: 12345,
name: "Updated Name",
description: "Updated description",
groupId: 2,
}),
}
);
const data = await response.json();
console.log(data);
| Parameter | Type | Required | Description |
|---|---|---|---|
| assetId | number | Yes | ID of the asset to update |
| Field | Type | Required | Description |
|---|---|---|---|
| assetId | number | Yes | ID of the asset to update (must match path parameter) |
| name | string | No | New display name for the asset. Omit to leave unchanged. |
| description | string | null | No | New description for the asset. Pass null to clear. Omit to leave unchanged. |
| groupId | number | null | No | New group ID to assign. Pass null to ungroup. Omit to leave unchanged. |
name, description, or groupId must be provided to update the asset.{
"id": 12345,
"content": "https://example.com",
"name": "Updated Name",
"description": "Updated description",
"groupId": 2
}
| Field | Type | Description |
|---|---|---|
| id | number | Asset ID |
| content | string | Asset content (unchanged) |
| name | string | Updated display name |
| description | string | null | Updated description (null if cleared) |
| groupId | number | null | Updated group ID (null if ungrouped) |
const response = await fetch(
"https://app.chainpatrol.io/api/v2/organization/assets/12345",
{
method: "PATCH",
headers: {
"Content-Type": "application/json",
"X-API-KEY": "YOUR_API_KEY_HERE",
},
body: JSON.stringify({
assetId: 12345,
name: "New Display Name",
}),
}
);
const response = await fetch(
"https://app.chainpatrol.io/api/v2/organization/assets/12345",
{
method: "PATCH",
headers: {
"Content-Type": "application/json",
"X-API-KEY": "YOUR_API_KEY_HERE",
},
body: JSON.stringify({
assetId: 12345,
description: "Updated asset description",
}),
}
);
const response = await fetch(
"https://app.chainpatrol.io/api/v2/organization/assets/12345",
{
method: "PATCH",
headers: {
"Content-Type": "application/json",
"X-API-KEY": "YOUR_API_KEY_HERE",
},
body: JSON.stringify({
assetId: 12345,
description: null,
}),
}
);
const response = await fetch(
"https://app.chainpatrol.io/api/v2/organization/assets/12345",
{
method: "PATCH",
headers: {
"Content-Type": "application/json",
"X-API-KEY": "YOUR_API_KEY_HERE",
},
body: JSON.stringify({
assetId: 12345,
groupId: 3,
}),
}
);
const response = await fetch(
"https://app.chainpatrol.io/api/v2/organization/assets/12345",
{
method: "PATCH",
headers: {
"Content-Type": "application/json",
"X-API-KEY": "YOUR_API_KEY_HERE",
},
body: JSON.stringify({
assetId: 12345,
groupId: null,
}),
}
);
const response = await fetch(
"https://app.chainpatrol.io/api/v2/organization/assets/12345",
{
method: "PATCH",
headers: {
"Content-Type": "application/json",
"X-API-KEY": "YOUR_API_KEY_HERE",
},
body: JSON.stringify({
assetId: 12345,
name: "Treasury Multi-Sig",
description: "Main treasury wallet with 3/5 multisig",
groupId: 2,
}),
}
);
{
"error": {
"code": "BAD_REQUEST",
"message": "At least one field (name, description, or groupId) must be provided"
}
}
{
"error": {
"code": "UNAUTHORIZED",
"message": "API key with organization access required"
}
}
{
"error": {
"code": "FORBIDDEN",
"message": "Asset does not belong to your organization"
}
}
{
"error": {
"code": "NOT_FOUND",
"message": "Asset with ID 12345 not found"
}
}
| Error Message | Cause | Resolution |
|---|---|---|
| Asset with ID not found | Invalid asset ID | Verify the asset ID exists |
| Asset does not belong to your organization | Asset belongs to a different organization | Use an asset ID from your organization |
| Group with ID not found | Invalid group ID | Use a valid group ID from your organization |
| At least one field must be provided | Empty update request | Provide at least one field to update |
| Path parameter assetId does not match body | Mismatch between URL and body asset IDs | Ensure both asset IDs match |
null to clear a field (description, groupId)async function updateMultipleAssets(updates: Array<{ id: number; data: any }>) {
const results = [];
for (const update of updates) {
try {
const response = await fetch(
`https://app.chainpatrol.io/api/v2/organization/assets/${update.id}`,
{
method: "PATCH",
headers: {
"Content-Type": "application/json",
"X-API-KEY": "YOUR_API_KEY_HERE",
},
body: JSON.stringify({
assetId: update.id,
...update.data,
}),
}
);
const data = await response.json();
results.push({ id: update.id, success: true, data });
} catch (error) {
results.push({ id: update.id, success: false, error });
}
}
return results;
}
// Update multiple assets
const updates = [
{ id: 12345, data: { name: "Updated Name 1" } },
{ id: 12346, data: { groupId: 2 } },
{ id: 12347, data: { description: null } },
];
updateMultipleAssets(updates)
.then((results) => console.log("Update results:", results));
// Move all URL assets to "Websites" group
async function organizeURLAssets() {
// First, get all URL assets
const listResponse = await fetch(
"https://app.chainpatrol.io/api/v2/organization/assets?type=URL",
{
headers: { "X-API-KEY": "YOUR_API_KEY_HERE" },
}
);
const { assets } = await listResponse.json();
// Then update each to assign to group
for (const asset of assets) {
await fetch(
`https://app.chainpatrol.io/api/v2/organization/assets/${asset.id}`,
{
method: "PATCH",
headers: {
"Content-Type": "application/json",
"X-API-KEY": "YOUR_API_KEY_HERE",
},
body: JSON.stringify({
assetId: asset.id,
groupId: 1, // Websites group
}),
}
);
}
}
// Add descriptions to assets that don't have them
async function addDescriptions(assetDescriptions: Map<number, string>) {
for (const [assetId, description] of assetDescriptions) {
await fetch(
`https://app.chainpatrol.io/api/v2/organization/assets/${assetId}`,
{
method: "PATCH",
headers: {
"Content-Type": "application/json",
"X-API-KEY": "YOUR_API_KEY_HERE",
},
body: JSON.stringify({
assetId,
description,
}),
}
);
}
}
updatedAt timestamp will be updated when any field changesYour API key. This is required by most endpoints to access our API programatically. Reach out to us at support@chainpatrol.io to get an API key for your use.
ID of the asset to update
x > 0Was this page helpful?