Docs › GET STARTED › Introduction
Introduction
Welcome to the CLEAR API - your gateway to humanitarian intelligence.
The CLEAR API gives you programmatic access to signals, events, alerts, data sources, and geographic location data through a single GraphQL endpoint. Whether you’re building a monitoring dashboard, integrating alerts into your workflow, or analysing humanitarian patterns, this API has you covered.
Everything here is accessible via GraphQL at /graphql. You send a query describing exactly the data you want, and you get back precisely that — nothing more, nothing less.
What You Can Do
| Feature | Description |
|---|---|
| Signals | Access raw data items collected from data sources, with location links and metadata. |
| Events | Browse grouped signals forming coherent situations, with location, population, and type data. |
| Alerts | View events escalated for notification, delivered to subscribed users. |
| Data Sources | Discover the external data feeds (ACLED, FEWS NET, social media monitors) that supply signals. |
| Locations | Query a hierarchical geographic tree — countries, states, cities — with PostGIS geometry. |
| Disaster Types | Look up disaster classifications with GLIDE numbers. |
| Feature Flags | Check runtime feature toggles to adapt your application’s behaviour. |
| API Keys | Create and manage personal API keys for server-to-server authentication. |
Quick Start
Go from zero to your first API response in three steps.
Create an account
Head to the Developer Portal and sign up. It takes about ten seconds.
Generate an API key
In the portal, go to API Keys and create one. Copy it immediately — you won’t see it again.
Make your first query
Send a request with your key in the Authorization header:
curl -X POST https://api.clearinitiative.io/graphql \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query":"{ me { id email } }"}'
Want to explore interactively? Open the GraphQL Sandbox to browse the full schema, autocomplete queries, and test requests in your browser.
Authentication
Two ways to authenticate, depending on your use case.
API Keys (server-to-server)
Pass your key as a Bearer token in the Authorization header:
Authorization: Bearer sk_live_your_key_here
Session Cookies (browser apps)
Sign in via the REST auth API. The session cookie is set automatically and sent with subsequent requests:
// Sign in
const res = await fetch('/api/auth/sign-in/email', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
credentials: 'include',
body: JSON.stringify({ email: 'you@example.com', password: '...' }),
});
// Then query (cookie sent automatically)
const data = await fetch('/graphql', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
credentials: 'include',
body: JSON.stringify({ query: '{ me { id email } }' }),
});
Queries
| Name | Returns | Description |
|---|---|---|
me |
User |
Returns the currently authenticated user, or null if not signed in. |
users |
[User!]! |
List all users. |
user |
User |
Look up a user by ID.id: String! |
alerts |
[Alert!]! |
List alerts, optionally filtered by status.status: AlertStatus |
alert |
Alert |
Look up an alert by ID.id: String! |
signals |
[Signal!]! |
List all signals. |
signal |
Signal |
Look up a signal by ID.id: String! |
events |
[Event!]! |
List all events. |
event |
Event |
Look up an event by ID.id: String! |
dataSources |
[DataSource!]! |
List all data sources. |
dataSource |
DataSource |
Look up a data source by ID.id: String! |
locations |
[Location!]! |
List locations, optionally filtered by hierarchy level (0 = country, 1 = state, etc.).level: Int |
location |
Location |
Look up a location by ID.id: String! |
notifications |
[Notification!]! |
List notifications, optionally filtered by status.status: NotificationStatus |
notification |
Notification |
Look up a notification by ID.id: String! |
featureFlags |
[FeatureFlag!]! |
List all feature flags. |
featureFlag |
FeatureFlag |
Look up a feature flag by its unique key.key: String! |
disasterTypes |
[DisasterType!]! |
List all disaster type classifications. |
disasterType |
DisasterType |
Look up a disaster type by ID.id: String! |
myApiKeys |
[ApiKey!]! |
List all API keys belonging to the authenticated user. Requires authentication. |
Mutations
| Name | Returns | Description |
|---|---|---|
createApiKey |
CreateApiKeyPayload! |
Create a new API key for the authenticated user.input: CreateApiKeyInput! |
revokeApiKey |
ApiKey! |
Revoke an API key by ID. Only the key owner or an admin can revoke.id: String! |
requestEmailVerification |
Boolean! |
Request an email verification link for the authenticated user. |
verifyEmail |
Boolean! |
Verify email using a token from the verification link.token: String! |
updateProfile |
User! |
Update the authenticated user's profile and notification preferences.input: UpdateProfileInput! |
createAlert |
Alert! |
Create an alert from an event, notifying subscribers.input: CreateAlertInput! |
updateAlert |
Alert! |
Update an existing alert.id: String!input: UpdateAlertInput! |
deleteAlert |
Boolean! |
Delete an alert.id: String! |
createSignal |
Signal! |
Create a signal from a data source.input: CreateSignalInput! |
deleteSignal |
Boolean! |
Delete a signal.id: String! |
createEvent |
Event! |
Create a new event from signals.input: CreateEventInput! |
updateEvent |
Event! |
Update an existing event.id: String!input: UpdateEventInput! |
deleteEvent |
Boolean! |
Delete an event.id: String! |
createDataSource |
DataSource! |
Create a new data source.input: CreateDataSourceInput! |
updateDataSource |
DataSource! |
Update an existing data source.id: String!input: UpdateDataSourceInput! |
deleteDataSource |
Boolean! |
Delete a data source.id: String! |
createLocation |
Location! |
Create a new location.input: CreateLocationInput! |
updateLocation |
Location! |
Update an existing location.id: String!input: UpdateLocationInput! |
deleteLocation |
Boolean! |
Delete a location.id: String! |
createNotification |
Notification! |
Create a notification for a user.input: CreateNotificationInput! |
deleteNotification |
Boolean! |
Delete a notification.id: String! |
markNotificationRead |
Notification! |
Mark a notification as read.id: String! |
markAllNotificationsRead |
Boolean! |
Mark all notifications as read for the authenticated user. |
Types
All types in the schema, auto-generated from the running server.
DateTime scalar
ISO 8601 date-time string
GeoJSON scalar
GeoJSON object (RFC 7946)
JSON scalar
Arbitrary JSON value
AlertStatus enum
Publication status of an alert.
| Value | Description |
|---|---|
draft | — |
published | — |
archived | — |
DetectionStatus enum
Processing status of a detection (retained for potential future use).
| Value | Description |
|---|---|
raw | — |
processed | — |
ignored | — |
NotificationStatus enum
| Value | Description |
|---|---|
PENDING | — |
DELIVERED | — |
FAILED | — |
READ | — |
CreateAlertInput input
| Field | Type | Description |
|---|---|---|
eventId |
String! |
The event ID to create an alert from. |
status |
AlertStatus |
— |
CreateApiKeyInput input
Input for creating a new API key.
| Field | Type | Description |
|---|---|---|
name |
String! |
A descriptive name for this key (e.g. my-app-prod). |
expiresAt |
DateTime |
Optional expiration date. Omit for a key that never expires. |
CreateDataSourceInput input
| Field | Type | Description |
|---|---|---|
name |
String! |
— |
type |
String! |
— |
isActive |
Boolean |
— |
baseUrl |
String |
— |
infoUrl |
String |
— |
CreateEventInput input
| Field | Type | Description |
|---|---|---|
signalIds |
[String!]! |
— |
title |
String |
— |
description |
String |
— |
descriptionSignals |
JSON |
— |
validFrom |
String! |
— |
validTo |
String! |
— |
firstSignalCreatedAt |
String! |
— |
lastSignalCreatedAt |
String! |
— |
originId |
String |
— |
destinationId |
String |
— |
locationId |
String |
— |
types |
[String!]! |
— |
populationAffected |
String |
— |
rank |
Float! |
— |
CreateLocationInput input
| Field | Type | Description |
|---|---|---|
geoId |
Int |
— |
osmId |
String |
— |
pCode |
String |
— |
name |
String! |
— |
level |
Int! |
— |
parentId |
String |
— |
CreateNotificationInput input
| Field | Type | Description |
|---|---|---|
userId |
String! |
— |
message |
String! |
— |
notificationType |
String! |
— |
actionUrl |
String |
— |
actionText |
String |
— |
CreateSignalInput input
| Field | Type | Description |
|---|---|---|
sourceId |
String! |
— |
rawData |
JSON! |
— |
publishedAt |
String! |
— |
collectedAt |
String |
— |
url |
String |
— |
title |
String |
— |
description |
String |
— |
originId |
String |
— |
destinationId |
String |
— |
locationId |
String |
— |
UpdateAlertInput input
| Field | Type | Description |
|---|---|---|
status |
AlertStatus |
— |
UpdateDataSourceInput input
| Field | Type | Description |
|---|---|---|
name |
String |
— |
type |
String |
— |
isActive |
Boolean |
— |
baseUrl |
String |
— |
infoUrl |
String |
— |
UpdateEventInput input
| Field | Type | Description |
|---|---|---|
signalIds |
[String!] |
— |
title |
String |
— |
description |
String |
— |
descriptionSignals |
JSON |
— |
validFrom |
String |
— |
validTo |
String |
— |
firstSignalCreatedAt |
String |
— |
lastSignalCreatedAt |
String |
— |
originId |
String |
— |
destinationId |
String |
— |
locationId |
String |
— |
types |
[String!] |
— |
populationAffected |
String |
— |
rank |
Float |
— |
UpdateLocationInput input
| Field | Type | Description |
|---|---|---|
geoId |
Int |
— |
osmId |
String |
— |
pCode |
String |
— |
name |
String |
— |
level |
Int |
— |
parentId |
String |
— |
UpdateProfileInput input
| Field | Type | Description |
|---|---|---|
name |
String |
— |
phoneNumber |
String |
— |
image |
String |
— |
enableInAppNotification |
Boolean |
— |
enableEmailNotification |
Boolean |
— |
enableSMSNotification |
Boolean |
— |
Alert object
An alert created from an event, distributed to subscribed users.
| Field | Type | Description |
|---|---|---|
id |
String! |
— |
event |
Event! |
The event this alert was created from. |
status |
AlertStatus! |
— |
userAlerts |
[UserAlert!]! |
Users who received this alert. |
ApiKey object
A personal API key for programmatic access. The full key is only shown once at creation.
| Field | Type | Description |
|---|---|---|
id |
String! |
— |
name |
String! |
Descriptive name you chose when creating the key. |
prefix |
String! |
Short prefix for identification (e.g. sk_live_abc1). |
expiresAt |
DateTime |
Optional expiration date. Expired keys are rejected automatically. |
lastUsedAt |
DateTime |
When this key was last used to authenticate a request. |
revokedAt |
DateTime |
When this key was revoked, if applicable. Revocation is permanent. |
createdAt |
DateTime! |
— |
updatedAt |
DateTime! |
— |
CommentTag object
A tag linking a user to a comment.
| Field | Type | Description |
|---|---|---|
user |
User! |
— |
comment |
UserComment! |
— |
CreateApiKeyPayload object
Returned only from createApiKey. Contains the full plaintext key that will never be retrievable again.
| Field | Type | Description |
|---|---|---|
apiKey |
ApiKey! |
— |
key |
String! |
The full API key. Copy this immediately — it cannot be retrieved later. |
DataSource object
An external data source that feeds signals into the system.
| Field | Type | Description |
|---|---|---|
id |
String! |
— |
name |
String! |
— |
type |
String! |
Source type identifier (e.g. satellite, sensor, manual). |
isActive |
Boolean! |
— |
baseUrl |
String |
Base URL of the data source API. |
infoUrl |
String |
URL with more information about this source. |
createdAt |
DateTime! |
— |
updatedAt |
DateTime! |
— |
signals |
[Signal!]! |
Signals collected from this data source. |
DisasterType object
A disaster classification with GLIDE number.
| Field | Type | Description |
|---|---|---|
id |
String! |
— |
disasterType |
String! |
— |
disasterClass |
String! |
— |
glideNumber |
String! |
— |
Event object
An event grouping related signals into a coherent situation.
| Field | Type | Description |
|---|---|---|
id |
String! |
— |
title |
String |
— |
description |
String |
— |
descriptionSignals |
JSON |
LLM-generated signal descriptions as JSON. |
validFrom |
DateTime! |
— |
validTo |
DateTime! |
— |
firstSignalCreatedAt |
DateTime! |
— |
lastSignalCreatedAt |
DateTime! |
— |
originLocation |
Location |
Origin location of the event. |
destinationLocation |
Location |
Destination location of the event. |
generalLocation |
Location |
General location (when no origin/destination). |
types |
[String!]! |
Event type tags. |
populationAffected |
String |
Estimated population affected. |
rank |
Float! |
— |
signals |
[Signal!]! |
Signals linked to this event. |
alerts |
[Alert!]! |
Alerts created from this event. |
feedbacks |
[UserFeedback!]! |
User feedback on this event. |
comments |
[UserComment!]! |
User comments on this event. |
escalations |
[EventEscalation!]! |
Escalations by users. |
EventEscalation object
Tracks a user escalating an event, optionally to a situation.
| Field | Type | Description |
|---|---|---|
id |
String! |
— |
user |
User! |
— |
event |
Event! |
— |
isSituation |
Boolean! |
Whether this has been escalated to a situation. |
validFrom |
DateTime! |
— |
validTo |
DateTime! |
— |
FeatureFlag object
A feature toggle that controls runtime behavior.
| Field | Type | Description |
|---|---|---|
id |
Int! |
— |
key |
String! |
Unique key used to look up this flag (e.g. dark_mode). |
enabled |
Boolean! |
— |
updatedAt |
DateTime! |
— |
Location object
A geographic location in a hierarchy (country > state > city, etc.).
| Field | Type | Description |
|---|---|---|
id |
String! |
— |
geoId |
Int |
GeoNames identifier. |
osmId |
String |
OpenStreetMap identifier. |
pCode |
String |
P-Code identifier. |
name |
String! |
— |
level |
Int! |
Hierarchy level: 0 = country, 1 = state/province, 2 = city, etc. |
geometry |
GeoJSON |
Geometry as GeoJSON (Point or MultiPolygon). |
parent |
Location |
Parent location in the hierarchy. |
children |
[Location!]! |
Child locations one level below. |
Notification object
| Field | Type | Description |
|---|---|---|
id |
String! |
— |
user |
User! |
— |
message |
String! |
— |
notificationType |
String! |
— |
actionUrl |
String |
— |
actionText |
String |
— |
status |
NotificationStatus! |
— |
emailNotificationStatus |
NotificationStatus |
— |
smsNotificationStatus |
NotificationStatus |
— |
createdAt |
DateTime! |
— |
updatedAt |
DateTime! |
— |
OrganisationUser object
Links a user to an organisation with a role.
| Field | Type | Description |
|---|---|---|
id |
String! |
— |
userId |
String! |
— |
organisationId |
String! |
— |
role |
String! |
— |
Signal object
A signal derived from a data source.
| Field | Type | Description |
|---|---|---|
id |
String! |
— |
source |
DataSource! |
The data source this signal was collected from. |
rawData |
JSON! |
Original signal payload as JSON. |
publishedAt |
DateTime! |
— |
collectedAt |
DateTime! |
— |
url |
String |
— |
title |
String |
— |
description |
String |
— |
originLocation |
Location |
Origin location of the signal. |
destinationLocation |
Location |
Destination location of the signal. |
generalLocation |
Location |
General location (when no origin/destination). |
events |
[Event!]! |
Events this signal is linked to. |
feedbacks |
[UserFeedback!]! |
User feedback on this signal. |
comments |
[UserComment!]! |
User comments on this signal. |
User object
A registered user with role-based access.
| Field | Type | Description |
|---|---|---|
id |
String! |
— |
email |
String! |
— |
name |
String! |
— |
emailVerified |
Boolean! |
— |
phoneNumber |
String |
— |
image |
String |
— |
role |
String! |
User role: viewer, editor, or admin. |
isActive |
Boolean! |
— |
enableInAppNotification |
Boolean! |
— |
enableEmailNotification |
Boolean! |
— |
enableSMSNotification |
Boolean! |
— |
createdAt |
DateTime! |
— |
updatedAt |
DateTime! |
— |
alerts |
[UserAlert!]! |
Alerts received by this user. |
notifications |
[Notification!]! |
— |
organisations |
[OrganisationUser!]! |
Organisations this user belongs to. |
feedbacks |
[UserFeedback!]! |
Feedback given by this user. |
comments |
[UserComment!]! |
Comments made by this user. |
escalations |
[EventEscalation!]! |
Events/alerts escalated by this user. |
UserAlert object
Tracks an alert delivered to a user — view status.
| Field | Type | Description |
|---|---|---|
id |
String! |
— |
user |
User! |
— |
alert |
Alert! |
— |
viewedAt |
DateTime |
When the user viewed this alert. |
UserComment object
A user comment on a signal or event, with reply support.
| Field | Type | Description |
|---|---|---|
id |
String! |
— |
user |
User! |
— |
event |
Event |
— |
signal |
Signal |
— |
comment |
String! |
— |
isCommentReply |
Boolean! |
Whether this comment is a reply to another comment. |
repliedToCommentId |
String |
ID of the comment being replied to, if any. |
tags |
[CommentTag!]! |
Users tagged in this comment. |
createdAt |
DateTime! |
— |
updatedAt |
DateTime! |
— |
UserFeedback object
User feedback on a signal or event — rating and optional text.
| Field | Type | Description |
|---|---|---|
id |
String! |
— |
user |
User! |
— |
event |
Event |
— |
signal |
Signal |
— |
rating |
Int! |
Rating from 1 to 5. |
text |
String |
Optional textual feedback. |
createdAt |
DateTime! |
— |
updatedAt |
DateTime! |
— |