Corpus Product API Integration Guide
This guide provides everything you need to integrate with the Intrace Corpus Product API.Getting Started
1. Obtain API Key
Contact your Intrace representative to receive an API key. The API key is required for all requests.2. Base URLs
Production:https://api.corpus.intrace.ai
Development: http://localhost:8000 (for testing)
3. Authentication
All requests must include your API key in theX-API-Key header:
Common Use Cases
Available Event Filters
The/v1/events endpoint supports the following filter parameters:
Categorical filters — all accept multiple values (repeat the parameter to filter by multiple values):
event_category- Filter by category (e.g., “conflict”, “cyber”, “crime”)event_type- Filter by type within a categoryevent_subtype- Filter by subtype within a typecountry- Filter by country code
date_from- Inclusive start date (YYYY-MM-DD)date_to- Inclusive end date (YYYY-MM-DD)
salience_score_min/salience_score_max- Filter by salience scorearticle_count_min/article_count_max- Filter by number of source articlesactor_count_min/actor_count_max- Filter by number of actors involved
search- Full-text search across title and description
sort_by- Sort column:event_date(default),salience_score,article_count,title,created_atsort_order- Sort direction: “asc” or “desc” (default: “desc”)
sort_by value silently falls back to event_date. No validation error is returned — double-check spellings if results appear sorted unexpectedly.
Multi-Value Filtering
Categorical filters (event_category, event_type, event_subtype, country) accept multiple values by repeating the parameter:
Query Events by Category
Filter events by category to focus on specific domains:Filter by Date Range
Get events within a specific time period:Search Events
Search across event titles and descriptions:Get Event Details
Retrieve full details including category-specific data:Export Data
Export filtered events in various formats:Discover Filter Values
Use metadata endpoints to find valid filter values:Available Actor Filters
The/v1/actors endpoint supports:
Categorical filters (multi-value, repeat parameter for multiple values):
actor_type- Filter by actor category (e.g., “rebel_group”, “state_government”)country- Filter by actor’s primary country
event_count_min/event_count_max- Filter by number of events the actor appears inarticle_count_min/article_count_max- Filter by number of source articles
search- Search in canonical actor name
sort_by- Sort column:canonical_name(default),event_count,article_count,created_atsort_order- Sort direction: “asc” (default) or “desc”
sort_by value silently falls back to canonical_name. No validation error is returned.
The /v1/actors/{id}/events endpoint accepts the same filter and sort parameters as /v1/events.
Pagination Best Practices
Handle large result sets with pagination:Paginating Actors
The same pagination pattern applies to actors:End-to-End Workflow Example
This example shows a complete analyst workflow: discover valid filter values, query high-salience conflict events in a region, then pull the event history for the most active actor involved.Code Examples
Python
Complete example using the requests library:JavaScript/TypeScript
Example using fetch API. Note that multi-value filters requireappend not set on URLSearchParams:
cURL
Basic cURL examples:Export Formats
CSV Format
Comma-separated values with headers. Suitable for spreadsheet analysis.- Use case: Import into Excel, Google Sheets, or data analysis tools
- File extension:
.csv - MIME type:
text/csv
JSON Format
Array of complete event objects with actors and metadata.- Use case: Programmatic processing, full data fidelity
- File extension:
.json - MIME type:
application/json
GeoJSON Format
Geographic data format following RFC 7946 specification.- Use case: Mapping applications, GIS tools, Leaflet/Mapbox
- File extension:
.geojson - MIME type:
application/geo+json
ACLED Format
Compatible with ACLED (Armed Conflict Location & Event Data Project) schema. Only available for conflict category events.- Use case: Integration with existing ACLED workflows and tools
- File extension:
.json - MIME type:
application/json
actor1,actor2: Principal and secondary actorsassoc_actor_1,assoc_actor_2: Internal sub-units (semicolon-separated)supporting_actor_1,supporting_actor_2: External supporting actors (comma-separated)inter1,inter2: Inter-group codes (1=state, 2=rebel, 3=political militia, etc.)interaction: Combined interaction code (e.g., “1-2” for state vs rebel)
Flat Format
Denormalized JSON with actor positions as explicit columns, suitable for spreadsheet import and tabular analysis.- Use case: Spreadsheet import where actor relationships need to be explicit
- File extension:
.json - MIME type:
application/json
principal_actor,secondary_actor: Main actorsprincipal_actor_category,secondary_actor_category: Actor categories (state_forces, rebel_group, etc.)sub_principal_actors,sub_secondary_actors: Internal sub-units (semicolon-separated)supporting_principal_actor,supporting_secondary_actor: External supporting actors (comma-separated)
- Sub-actors: Internal organizational units (e.g., “7th Division” within “Nigerian Army”)
- Supporting actors: External organizations providing support (e.g., “U.S. Special Forces” supporting “Colombian Army”)
Error Handling
The API uses standard HTTP status codes. All error responses share the same body shape:| Code | Meaning | Example detail |
|---|---|---|
| 200 | Success | — |
| 401 | Unauthorized | "Invalid or missing API key" |
| 404 | Not Found | "Event not found" |
| 422 | Validation Error | "value is not a valid integer" |
| 429 | Rate Limited | "Rate limit exceeded" |
| 500 | Server Error | "Internal server error" |
X-API-Key header is absent, empty, or does not match any active key. There is no distinction between a missing and an invalid key in the response body.
422 responses are returned for type validation failures (e.g., passing "abc" as article_count_min). They do not fire for unrecognised categorical values — passing an unknown event_category returns an empty result set, not an error.
Silent fallbacks — two parameters degrade gracefully instead of returning 422:
- An unrecognised
sort_byvalue silently falls back to the default sort column for that endpoint (event_datefor events,canonical_namefor actors).
Rate Limits
Default rate limits:- 100 requests per minute per API key
- 10,000 requests per day per API key
X-RateLimit-Remaining, Retry-After). Implement exponential backoff on 429 responses rather than relying on header-based scheduling.
Next Steps
- Explore the Event Taxonomy to understand all available categories and types
- Review Data Models for complete field structures
- See API Reference for detailed endpoint documentation