Blocks API
Manage reusable content blocks that can be shared across multiple prompts
GET
/tenants/{tenantId}/blocksAuth Required
List Blocks
Retrieve a paginated list of all blocks for a tenant
Path Parameters
| Name | Type | Description |
|---|---|---|
tenantId Required | string | Unique identifier for the tenant workspace |
Query Parameters
| Name | Type | Description |
|---|---|---|
page | number | Page number for pagination Default: 1 |
per_page | number | Number of results per page (max: 100) Default: 20 |
search | string | Search by name or description |
Examples
curl -X GET \
'https://api.staging.agnt.ai/tenants/tenant_123/blocks?page=1&per_page=20' \
-H 'Authorization: Bearer sk_live_your_service_key_here' \
-H 'Content-Type: application/json'Response Example
200 OK
{
"data": [
{
"blockName": "data_validator",
"description": "Validates and sanitizes user input",
"usedByPrompts": ["customer_support_agent", "email_responder"],
"createdAt": "2024-01-10T08:00:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
}
],
"page": 1,
"per_page": 20,
"has_more": false
}GET
/tenants/{tenantId}/blocks/{blockName}Auth Required
Get Block
Retrieve detailed information about a specific block
Path Parameters
| Name | Type | Description |
|---|---|---|
tenantId Required | string | Unique identifier for the tenant workspace |
blockName Required | string | Unique name identifier for the block |
Examples
curl -X GET \
'https://api.staging.agnt.ai/tenants/tenant_123/blocks/data_validator' \
-H 'Authorization: Bearer sk_live_your_service_key_here' \
-H 'Content-Type: application/json'Response Example
200 OK
{
"data": {
"blockName": "data_validator",
"content": "function validateData(input) { return input.trim(); }",
"description": "Validates and sanitizes user input",
"usedByPrompts": ["customer_support_agent", "email_responder"],
"createdAt": "2024-01-10T08:00:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
}
}POST
/tenants/{tenantId}/blocksAuth Required
Create Block
Create a new reusable block
Path Parameters
| Name | Type | Description |
|---|---|---|
tenantId Required | string | Unique identifier for the tenant workspace |
Request Body
| Name | Type | Description |
|---|---|---|
blockName Required | string | Unique name identifier for the block (lowercase, underscores) |
content Required | string | The block content (code, template, etc.) |
description Required | string | Description of the block purpose |
Examples
curl -X POST \
'https://api.staging.agnt.ai/tenants/tenant_123/blocks' \
-H 'Authorization: Bearer sk_live_your_service_key_here' \
-H 'Content-Type: application/json' \
-d '{
"blockName": "data_validator",
"content": "function validateData(input) { return input.trim(); }",
"description": "Validates and sanitizes user input"
}'Response Example
200 OK
{
"data": {
"blockName": "data_validator",
"description": "Validates and sanitizes user input",
"usedByPrompts": [],
"createdAt": "2024-01-16T10:00:00Z"
}
}PATCH
/tenants/{tenantId}/blocks/{blockName}Auth Required
Update Block
Update an existing block
Path Parameters
| Name | Type | Description |
|---|---|---|
tenantId Required | string | Unique identifier for the tenant workspace |
blockName Required | string | Unique name identifier for the block |
Request Body
| Name | Type | Description |
|---|---|---|
content | string | The block content (code, template, etc.) |
description | string | Description of the block purpose |
Examples
curl -X PATCH \
'https://api.staging.agnt.ai/tenants/tenant_123/blocks/data_validator' \
-H 'Authorization: Bearer sk_live_your_service_key_here' \
-H 'Content-Type: application/json' \
-d '{
"content": "function validateData(input) { /* updated */ return input.trim(); }",
"description": "Updated description"
}'Response Example
200 OK
{
"data": {
"blockName": "data_validator",
"content": "function validateData(input) { /* updated */ return input.trim(); }",
"description": "Updated description",
"usedByPrompts": ["customer_support_agent", "email_responder"],
"updatedAt": "2024-01-16T11:00:00Z"
}
}DELETE
/tenants/{tenantId}/blocks/{blockName}Auth Required
Delete Block
Delete a block
Path Parameters
| Name | Type | Description |
|---|---|---|
tenantId Required | string | Unique identifier for the tenant workspace |
blockName Required | string | Unique name identifier for the block |
Examples
curl -X DELETE \
'https://api.staging.agnt.ai/tenants/tenant_123/blocks/data_validator' \
-H 'Authorization: Bearer sk_live_your_service_key_here'Response Example
200 OK
{
"message": "Block deleted successfully"
}