Resources
Endpoints for managing trade policy resources (documents, guides, references).
GET /api/v1/resources
Search the resource collection with optional filters.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
query | string | - | Text search across title and description |
resource_type | string | - | Filter: "reference", "guidance", "legal", "educational", "news", "tool" |
source_authority | string | - | Filter by source (e.g., "USTR", "CBP") |
verified_only | boolean | true | Only return verified resources |
limit | integer | 50 | Maximum results (1-50) |
Response 200
[
{
"id": 1,
"resource_type": "reference",
"title": "Harmonized Tariff Schedule - Wikipedia",
"url": "https://en.wikipedia.org/wiki/Harmonized_Tariff_Schedule",
"description": "Overview of the HTS structure and history",
"topics": ["hts", "overview"],
"source_authority": "Wikipedia",
"verified": true,
"last_verified": "2024-12-01",
"added_by": "system"
}
]GET /api/v1/resources/stats
Aggregate statistics about the resource collection.
Response 200
{
"total_resources": 45,
"verified": 38,
"unverified": 7,
"by_type": { "reference": 15, "guidance": 12, "legal": 8 },
"by_authority": { "USTR": 10, "CBP": 8, "Wikipedia": 6 },
"by_added": { "system": 38, "manual": 7 },
"recently_updated": [...]
}GET /api/v1/resources/export
Export the complete resource collection as JSON.
Response 200
{
"json_data": [...],
"stats": { "total": 45, "verified": 38 },
"instructions": "Import this data using the load-tariff-resources CLI command"
}GET /api/v1/resources/{id}
Get a single resource by its ID.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | integer | Resource ID |
Response 200
{
"id": 1,
"resource_type": "reference",
"title": "Harmonized Tariff Schedule - Wikipedia",
"url": "https://en.wikipedia.org/wiki/Harmonized_Tariff_Schedule",
"description": "Overview of the HTS structure and history",
"topics": ["hts", "overview"],
"source_authority": "Wikipedia",
"verified": true
}Errors
| Status | Condition |
|---|---|
404 | Resource not found |
POST /api/v1/resources
Add a new trade policy resource. Created as unverified by default.
Request Body
{
"title": "USTR Section 301 Overview",
"url": "https://ustr.gov/section-301",
"description": "Overview of Section 301 tariff actions",
"resource_type": "guidance",
"topics": ["section-301", "tariffs"],
"source_authority": "USTR",
"coverage_start_date": "2024-01-01"
}Response 201
{
"success": true,
"resource_id": 42,
"message": "Resource added successfully",
"note": "Resource created as unverified. It will be reviewed before appearing in verified results."
}PATCH /api/v1/resources/{id}/verify
Toggle the verification status of a resource.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | integer | Resource ID |
Response 200
{
"success": true,
"resource_id": 42,
"verified": true,
"message": "Resource verified"
}Errors
| Status | Condition |
|---|---|
404 | Resource not found |