curl --request POST \
--url https://app.chainpatrol.io/api/v2/organization/assets \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"assets": [
{
"content": "<string>",
"name": "<string>",
"description": "<string>",
"groupId": 1
}
]
}
'{
"results": [
{
"content": "<string>",
"success": true,
"id": 123,
"error": "<string>"
}
],
"successCount": 123,
"errorCount": 123
}Batch add multiple assets to your organization’s allowlist. Each asset will be automatically parsed, classified, and approved as ALLOWED status. Supports optional group assignment.
curl --request POST \
--url https://app.chainpatrol.io/api/v2/organization/assets \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"assets": [
{
"content": "<string>",
"name": "<string>",
"description": "<string>",
"groupId": 1
}
]
}
'{
"results": [
{
"content": "<string>",
"success": true,
"id": 123,
"error": "<string>"
}
],
"successCount": 123,
"errorCount": 123
}ALLOWED status. This endpoint supports adding up to 1,000 assets per request with optional metadata like name, description, and group assignment.
X-API-KEY header:
X-API-KEY: your_api_key_here
const response = await fetch(
"https://app.chainpatrol.io/api/v2/organization/assets",
{
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-KEY": "YOUR_API_KEY_HERE",
},
body: JSON.stringify({
assets: [
{
content: "https://example.com",
name: "Main Website",
description: "Our official website",
groupId: 1,
},
{
content: "0x1234567890abcdef1234567890abcdef12345678",
name: "Treasury Wallet",
},
{
content: "@ourcompany",
},
],
}),
}
);
const data = await response.json();
console.log(data);
| Field | Type | Required | Description |
|---|---|---|---|
| assets | array | Yes | Array of assets to add (maximum 1,000 per request) |
| assets[].content | string | Yes | Asset content: URL, blockchain address, social media handle, email, domain, etc. |
| assets[].name | string | No | Display name for the asset. Useful for identifying assets in your dashboard. |
| assets[].description | string | No | Description providing context about the asset’s purpose or usage. |
| assets[].groupId | number | No | Group ID to assign the asset to. Must be a valid group belonging to your organization. |
https://example.com)@username){
"results": [
{
"content": "https://example.com",
"success": true,
"id": 12345
},
{
"content": "0x1234567890abcdef1234567890abcdef12345678",
"success": true,
"id": 12346
},
{
"content": "@ourcompany",
"success": true,
"id": 12347
}
],
"successCount": 3,
"errorCount": 0
}
{
"results": [
{
"content": "https://example.com",
"success": true,
"id": 12345
},
{
"content": "invalid-content",
"success": false,
"error": "Invalid asset format"
},
{
"content": "https://existing.com",
"success": false,
"error": "Asset already exists in organization"
}
],
"successCount": 1,
"errorCount": 2
}
| Field | Type | Description |
|---|---|---|
| results | array | Array of result objects, one for each submitted asset |
| results[].content | string | The asset content that was submitted |
| results[].success | boolean | Whether the asset was successfully added |
| results[].id | number | Asset ID (only present when success is true) |
| results[].error | string | Error message (only present when success is false) |
| successCount | number | Total number of assets successfully added |
| errorCount | number | Total number of assets that failed to be added |
{
"error": {
"code": "BAD_REQUEST",
"message": "Maximum 1000 assets allowed per request"
}
}
{
"error": {
"code": "UNAUTHORIZED",
"message": "API key with organization access required"
}
}
{
"error": {
"code": "NOT_FOUND",
"message": "Group with ID 999 not found"
}
}
| Error Message | Cause | Resolution |
|---|---|---|
| Invalid asset format | Asset content format not recognized | Verify the asset format matches a supported type |
| Asset already exists in organization | Duplicate asset in your organization | Asset is already in your allowlist, no action needed |
| Maximum 1000 assets allowed per request | Request contains more than 1,000 assets | Split into multiple requests |
| Group with ID not found | Invalid group ID | Use a valid group ID from your organization |
| Content is required | Missing content field | Provide the content field for each asset |
| Invalid group ID | Group ID format is invalid | Provide a valid numeric group ID |
successCount and errorCount in responseshttps:// or http://)
https://example.comexample.com (will be interpreted as domain, not URL)0x1234567890abcdef1234567890abcdef12345678@ symbol for Twitter/social platforms
@usernameusername (also works)results array for per-asset success/failure statussuccessCount and errorCount for aggregate reportingimport * as fs from "fs";
import * as csv from "csv-parse/sync";
async function importFromCSV(filePath: string) {
const fileContent = fs.readFileSync(filePath, "utf-8");
const records = csv.parse(fileContent, {
columns: true,
skip_empty_lines: true,
});
// Process in batches of 1000
for (let i = 0; i < records.length; i += 1000) {
const batch = records.slice(i, i + 1000);
const assets = batch.map((row) => ({
content: row.content,
name: row.name,
description: row.description,
groupId: row.groupId ? parseInt(row.groupId) : undefined,
}));
const response = await fetch(
"https://app.chainpatrol.io/api/v2/organization/assets",
{
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-KEY": process.env.API_KEY,
},
body: JSON.stringify({ assets }),
}
);
const result = await response.json();
console.log(
`Batch ${i / 1000 + 1}: ${result.successCount} succeeded, ${
result.errorCount
} failed`
);
// Log failures
result.results
.filter((r) => !r.success)
.forEach((r) => console.error(`Failed: ${r.content} - ${r.error}`));
}
}
const assets = [
// URLs
{
content: "https://our-website.com",
name: "Main Website",
groupId: 1,
},
{
content: "https://docs.our-website.com",
name: "Documentation",
groupId: 1,
},
// Blockchain addresses
{
content: "0x1234567890abcdef1234567890abcdef12345678",
name: "Treasury Wallet",
groupId: 2,
},
{
content: "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd",
name: "Staking Contract",
groupId: 2,
},
// Social media
{
content: "@ourcompany",
name: "Official Twitter",
groupId: 3,
},
{
content: "ourcompany",
name: "Discord Server",
description: "Official Discord community",
groupId: 3,
},
];
const response = await fetch(
"https://app.chainpatrol.io/api/v2/organization/assets",
{
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-KEY": "YOUR_API_KEY_HERE",
},
body: JSON.stringify({ assets }),
}
);
ALLOWED statusYour 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.
1 - 1000 elementsShow child attributes
Was this page helpful?