Observed since 20 Oct, 18:15 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
A Python library that unofficially wraps the ACLED API.
A Python library that unofficially wraps the ACLED (Armed Conflict Location & Event Data) API. This library provides a convenient interface for accessing and analyzing conflict and protest data from around the world.
ACLED (Armed Conflict Location & Event Data Project) is a disaggregated data collection, analysis, and crisis mapping project that tracks political violence and protest events across the world.
Install via pip:
pip install acled
ACLED requires authentication for all API requests. Register on the ACLED website to get credentials.
The library supports multiple authentication methods:
Use your ACLED username/email and password:
from acled import AcledClient
# Auto-detect best method (OAuth or Cookie)
client = AcledClient(username="your_email", password="your_password")
# Or use environment variables
# export ACLED_USERNAME="your_email" (or ACLED_EMAIL)
# export ACLED_PASSWORD="your_password"
client = AcledClient() # Auto-detects from environment
Still supported in the code, but seems broken in the API. Will be removed soon once confirmed:
client = AcledClient(api_key="your_api_key", email="your_email")
# Or use environment variables
# export ACLED_API_KEY="your_api_key"
# export ACLED_EMAIL="your_email"
from acled import AcledClient
from acled.models import AcledEvent
from typing import List
client = AcledClient()
# Fetch event data with filters
events: List[AcledEvent] = client.get_data(
country='Yemen',
year=2024,
limit=10
)
for event in events:
print(f"{event['event_date']}: {event['event_type']} - {event['country']}")
from acled import AcledClient
client = AcledClient()
# Fetch data with multiple filters
events = client.get_data(
country='Yemen',
year=2023,
event_type='Battles',
fatalities=5,
limit=5,
)
for event in events:
print(f"{event['country']} - {event['event_date']} - {event['fatalities']} fatalities")
Use _where suffixes via the query_params dictionary to change the default filter operator:
client = AcledClient()
# Filter events with more than 5 fatalities
events = client.get_data(
country='Yemen',
fatalities=5,
limit=10,
query_params={'fatalities_where': '>'},
)
# Filter events with event_type containing "Violence"
events = client.get_data(
limit=10,
query_params={
'event_type': 'Violence',
'event_type_where': 'LIKE',
}
)
Available operators:
= (default): Exact match>, <, >=, <=: Comparison operatorsLIKE: Partial match (case-insensitive)BETWEEN: Range filter (use pipe | to separate values)Use BETWEEN with pipe-separated dates:
events = client.get_data(
event_date='2023-01-01|2023-12-31',
query_params={'event_date_where': 'BETWEEN'},
limit=50,
)
The ACLED endpoint supports two data structure formats via export_type:
# Dyadic (default): one row per event, with actor1/actor2 columns
events = client.get_data(country='Yemen', limit=10)
# Monadic: one row per actor-event, same event may appear twice
events = client.get_data(country='Yemen', limit=10, export_type='monadic')
Limit which fields are returned using pipe-separated field names:
events = client.get_data(
country='Yemen',
fields='country|event_date|event_type|fatalities',
limit=10,
)
The library provides access to all ACLED API endpoints:
The main endpoint for conflict and protest events.
events = client.get_data(
country='Yemen',
year=2024,
event_type='Battles',
limit=10,
)
for event in events:
print(f"{event['event_date']} | {event['event_type']} | fatalities: {event['fatalities']}")
Conflict Alert System forecasts — predicted and observed event counts by region and month.
forecasts = client.get_cast_data(
country='Somalia',
year=2025,
limit=5,
)
for f in forecasts:
print(f"{f['country']} | {f['admin1']} | {f['month']}/{f['year']}"
f" | forecast: {f['total_forecast']} | observed: {f['total_observed']}")
Event IDs removed from the dataset (duplicates or out-of-scope).
deleted = client.get_deleted_data(limit=5)
for d in deleted:
print(f"{d['event_id_cnty']} | deleted_timestamp: {d['deleted_timestamp']}")
actors = client.get_actor_data(limit=5)
for actor in actors:
print(f"[{actor.get('mal_actor_id')}] {actor.get('label')}")
actor_types = client.get_actor_type_data(limit=5)
for at in actor_types:
print(at['actor_type_name'])
countries = client.get_country_data(limit=5)
for c in countries:
print(f"{c.get('nicename')} | iso: {c.get('iso')} | iso3: {c.get('iso3')}")
regions = client.get_region_data(limit=5)
for r in regions:
print(r['region_name'])
The library provides TypedDict models for type-checked API responses. All fields use total=False so missing fields don't raise errors (useful with the fields parameter).
Core event record with fields including:
event_id_cnty: Unique event identifierevent_date: Date of the event (datetime.date)year, time_precision: Temporal metadatadisorder_type, event_type, sub_event_type: Event classificationactor1, actor2, assoc_actor_1, assoc_actor_2: Actors involvedinter1, inter2, interaction: Actor type codescountry, admin1, admin2, admin3, location: Location hierarchylatitude, longitude, geo_precision: Coordinatesfatalities: Reported death countnotes, tags, source, source_scale: Descriptive metadatatimestamp: Upload timestamp (datetime.datetime, UTC)CAST conflict forecast with fields including:
country, admin1: Locationmonth, year: Time periodtotal_forecast, battles_forecast, erv_forecast, vac_forecast: Predicted event countstotal_observed, battles_observed, erv_observed, vac_observed: Actual event counts (populated after month ends)Removed event record:
event_id_cnty: Event identifierdeleted_timestamp: Unix timestamp of deletionMetadata models for actors, countries, regions, and actor type categories. Field availability varies by endpoint — use .get() for safe access.
from acled.models.enums import TimePrecision
TimePrecision.EXACT_DATE # 1
TimePrecision.APPROXIMATE_DATE # 2
TimePrecision.ESTIMATED_DATE # 3
from acled.models.enums import DisorderType
DisorderType.POLITICAL_VIOLENCE # "Political violence"
DisorderType.DEMONSTRATIONS # "Demonstrations"
DisorderType.STRATEGIC_DEVELOPMENTS # "Strategic developments"
Actor type codes for inter1/inter2 filters:
from acled.models.enums import Actor
Actor.STATE_FORCES # 1
Actor.REBEL_FORCES # 2
Actor.MILITIA_GROUPS # 3
Actor.COMMUNAL_IDENTITY_GROUPS # 4
Actor.RIOTERS # 5
Actor.PROTESTERS # 6
Actor.CIVILIANS # 7
Actor.FOREIGN_OTHERS # 8
from acled.models.enums import Region
Region.WESTERN_AFRICA # 1
Region.MIDDLE_AFRICA # 2
Region.EASTERN_AFRICA # 3
Region.SOUTHERN_AFRICA # 4
Region.NOTHERN_AFRICA # 5
Region.SOUTH_ASIA # 7
Region.SOUTHEAST_ASIA # 9
Region.MIDDLE_EAST # 11
Region.EUROPE # 12
Region.CAUCASUS_AND_CENTRAL_ASIA # 13
Region.CENTRAL_AMERICA # 14
Region.SOUTH_AMERICA # 15
Region.CARIBBEAN # 16
Region.EAST_ASIA # 17
Region.NORTH_AMERICA # 18
Region.OCEANIA # 19
Region.ANTARCTICA # 20
Environment variables for customizing library behavior:
Authentication:
ACLED_USERNAME or ACLED_EMAIL: Username/email for modern authACLED_PASSWORD: Password for modern authACLED_API_KEY: API key for legacy authACLED_EMAIL: Email for legacy authConnection:
ACLED_MAX_RETRIES: Maximum retry attempts (default: 3)ACLED_RETRY_BACKOFF_FACTOR: Backoff multiplier between retries (default: 0.5)ACLED_REQUEST_TIMEOUT: Request timeout in seconds (default: 30)The library includes a command-line interface:
# Auto-detect best method (recommended)
acled auth login
# Specify a method
acled auth login --method oauth
acled auth login --method cookie
acled auth login --method legacy
# Get recent events from Syria
acled data --country Syria --year 2024 --limit 10
# Filter by event type and fatalities
acled data --country Yemen --event-type Battles --fatalities 5
# Date range query
acled data --start-date 2024-01-01 --end-date 2024-06-30
# Control output display format (global flag)
acled --format table data --country Nigeria --limit 10
acled --format csv data --country Syria --year 2024
# Save to file
acled data --country Afghanistan --year 2024 --output events.json
Secure login (recommended):
acled auth login # Prompts for credentials
Environment variables:
export ACLED_USERNAME="your_email"
export ACLED_PASSWORD="your_password"
acled data --country Syria
Command-line options (legacy only):
acled data --api-key YOUR_API_KEY --email YOUR_EMAIL --country Syria
limit to 50 for safety. The API default is 5000. Increase the limit and use page for bulk data retrieval.git clone https://github.com/blazeiburgess/acled.git
cd acled
python -m venv venv
source venv/bin/activate
pip install -e ".[dev]"
pytest
pytest --cov=acled --cov-report=term-missing
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 1.0.2 | 11 Apr 2026 | 8 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 18:15 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:14499ecd93aa7234203f8edc1ffa3a429f18ace65d3a2efac84e7b4c9372334c