# Open Animals

## Agents — Start here!

Start with the [read-only action manifest](https://api.openanimals.run/api/v1/agent/actions). It lists each HTTP path, the query and path parameter schemas, the success response schema, and the rate-limit bucket. The [agent card](https://openanimals.run/.well-known/agent-card.json) links back to this guide and the manifest.

### Where to send requests

Use `https://api.openanimals.run` as the API origin. The marketing site at `https://openanimals.run` serves the same card and proxies the `/api/` routes. Send `GET` requests with URL-encoded query parameters and accept JSON. Substitute and URL-encode path parameters such as `{taxon}`.

All actions in the public manifest are anonymous. Omit cookies, authorization headers, and session tokens. Account records, private sightings, uploads and user-scoped operations belong to the application's existing authenticated flows. Identification and Ask are separate from this read-only manifest.

### Actions

All paths are relative to the API origin. `lang` selects Portuguese (Portugal), English or Spanish. The catalogue defaults to English and accepts tags such as `en-GB`. The geography endpoints default to `pt-PT` and accept `pt-PT`, `en`, or `es`.

| Action | GET path | Inputs | Output |
| --- | --- | --- | --- |
| Search species | `/api/v1/agent/species/search` | `q` (2–100 characters after trimming), optional `lang` and adult-mass bounds `mass_min_kg`, `mass_max_kg` (0–100,000 kg). The shared species query also accepts `units`. | Matching catalogue entries in `items`, including identifiers, names and match type. Mass filters always use kilograms. |
| Species details | `/api/v1/agent/species/{taxon}` | Numeric catalogue ID or lowercase slug, optional `lang` and `units` (`metric` or `imperial`) | A profile with taxonomy, stored facts, sources, and any available reference media |
| Nearby animals | `/api/v1/agent/nearby` | `lat`, `lng`, optional `lang`, `month` (1–12, default current UTC month), and `limit` (1–50, default 20) | One-degree cell ID, recorded species and occurrence counts, freshness and attribution |
| Nearby checklist | `/api/v1/agent/nearby/checklist` | `lat`, `lng`, optional `lang`, `season` (`winter`, `spring`, `summer`, `autumn`, default current local season by hemisphere and UTC month), and `limit` (1–50, default 30) | Cell ID, hemisphere, season and months, species with seasonal counts and habitat hints, freshness and attribution |
| Wildlife Radar | `/api/v1/radar` | Coarse area `lat` and `lng`, optional `lang`, `month` (1–12, default current UTC month), and `limit` (1–50, default 20) | Relative encounter rankings, scoring method, aggregate recent sighting counts, freshness and attribution for a one-degree cell |
| Places | `/api/v1/places` | `bbox` (maximum 2° per axis), optional `lang` and comma-separated `kinds` (`zoo`, `aquarium`, `wildlife_park`, `nature_reserve`, `national_park`) | Public venues and protected areas in `items`, with attribution |
| Area insights | `/api/v1/areas/insights` | `bbox` (maximum 60° per axis), optional `lang`, `from` and `to` dates (`YYYY-MM-DD`, defaults to the last year, up to 1,098 days), and `captive` (`include`, `exclude`, `only`, default `exclude`) | Recorded sighting totals and breakdowns, coarsened recent sightings, and GBIF coverage when available |
| Geocode | `/api/v1/geo/search` | Public place name `q` (2–200 characters after trimming), optional `lang`, `near` (`lat,lng`), and `limit` (1–10, default 5) | Public place matches in `items` with coordinates, optional bounds and attribution |

Write bounding boxes as `west,south,east,north`. Split a box that crosses the antimeridian into two requests. Nearby actions use stored GBIF aggregates and return `data_status` (`ready`, `stale`, `pending`, or `unavailable`). Area insights distinguish `empty` from `unavailable` and report GBIF freshness and coverage separately. Occurrence and sighting counts describe recorded observations. They cannot predict presence or estimate population size.

### Rate limits and errors

Limits apply per client IP in one-minute windows:

- 60 requests across the manifest and the two catalogue actions.
- 60 requests across the two nearby actions.
- 60 requests to Wildlife Radar.
- 10 requests to places, 60 shared by area insights and hotspots, and 30 shared by forward and reverse geocoding.

On HTTP `429`, wait at least the number of seconds in `Retry-After`. On `400`, correct the request. A missing species returns `404`. A missing integration can return `503`, or a response with `data_status: "unavailable"` where the action supports it.

### Location privacy

Use public place names and coarse area coordinates. Keep home addresses, private GPS coordinates, and identifying details out of queries, which may enter request logs or reach public map providers. The nearby actions and Wildlife Radar return one-degree wildlife aggregates without individual occurrence coordinates. Radar's place label describes the cell centre. Area insights include existing public sightings coarsened to 0.1°, or 1° for sensitive taxa. Keep those resolutions when storing or displaying results, and never try to reconstruct precise locations for a sighting, a sensitive species, or a person. Attribute the listed data providers when presenting their results.

### Examples

```bash
api=https://api.openanimals.run
curl -fsS "$api/api/v1/agent/actions"
curl -fsSG "$api/api/v1/agent/species/search" --data-urlencode 'q=red fox' --data-urlencode 'lang=en'
# Use the id or slug from a search result to retrieve its profile.
curl -fsS "$api/api/v1/agent/species/vulpes-vulpes?lang=en"
curl -fsS "$api/api/v1/agent/nearby?lat=45&lng=-110&month=7&lang=en"
curl -fsS "$api/api/v1/agent/nearby/checklist?lat=45&lng=-110&season=summer&lang=en"
curl -fsS "$api/api/v1/radar?lat=45&lng=-110&month=7&lang=en"
curl -fsSG "$api/api/v1/places" --data-urlencode 'bbox=-111,44,-109,46' --data-urlencode 'lang=en'
curl -fsSG "$api/api/v1/areas/insights" --data-urlencode 'bbox=-111,44,-109,46' --data-urlencode 'lang=en'
curl -fsSG "$api/api/v1/geo/search" --data-urlencode 'q=Yellowstone National Park' --data-urlencode 'lang=en'
```

## Wildlife Copilot plans (authenticated)

The [OpenAPI 3.1 document](https://openanimals.run/openapi.json) and the [API reference](https://openanimals.run/api/docs) describe every action above and the Copilot routes below. MCP clients can connect to `https://api.openanimals.run/mcp` (streamable HTTP, JSON responses).

A Copilot plan ranks animals that were recorded near a place in the planned month and season, using stored GBIF aggregates. It is a list of past records, not a forecast, and never states a probability of seeing anything. Each plan reports `job_state` (`ready`, `waiting_for_data`, `unavailable`) and `evidence.data_status` (`ready`, `stale`, `pending`, `unavailable`). Say so when data is stale or still loading.

Copilot routes act for one account. They need a token the account owner creates in the app (or with `POST /api/v1/copilot/agent-grants` from a signed-in session). Send it as `Authorization: Bearer oaa_…`. The token is shown once, stored only as a hash, expires after at most 90 days and can be revoked at any time. Grants and the audit trail can only be managed from the owner's own session.

| Scope | Allows |
| --- | --- |
| `plans:read` | `GET /api/v1/copilot/plans`, `GET /api/v1/copilot/plans/{id}`, `GET /api/v1/copilot/reminders/due` |
| `plans:write` | Create (`POST /api/v1/copilot/plans`), edit, refresh, cancel, and check off items (`PATCH /api/v1/copilot/plans/{id}/items/{taxon}`) |
| `reminders:write` | Set or cancel the plan's single opt-in reminder |

- Send an `Idempotency-Key` header (8–64 characters) when creating a plan. A retry with the same key returns the original plan with `200`.
- Edits (`PATCH /api/v1/copilot/plans/{id}`) and refreshes send the current `revision`. A stale revision returns `409`: read the plan again and retry.
- Refresh keeps items already marked `seen` or `skipped`.
- Attach only the account's own observations (`sighting:<id>` or `identification:<id>`). Anything else returns `404`.
- Ask the user before creating, changing or cancelling a plan for them. Every change records the grant that made it.
- Places are stored coarsened (0.01° for a searched place, 0.1° for a device position). Send public place names or coarse coordinates, never a home address.
- Errors are `application/problem+json` with `type` `urn:openanimals:copilot.<code>`. `401` means a missing, revoked or expired token. `403` with `insufficient_scope` means the grant lacks the scope. On `429`, wait for `Retry-After`.

MCP tools with the same grant: `copilot_plans_list`, `copilot_plan_get`, `copilot_plan_create` (accepts `idempotency_key`) and `copilot_item_update`. Without a token they return an error and change nothing.

```bash
api=https://api.openanimals.run
curl -fsS "$api/api/v1/copilot/plans" -H "Authorization: Bearer $OA_AGENT_TOKEN"
curl -fsS -X POST "$api/api/v1/copilot/plans" -H "Authorization: Bearer $OA_AGENT_TOKEN" \
  -H 'Content-Type: application/json' -H 'Idempotency-Key: trip-2026-05-10-lisboa' \
  -d '{"intent":{"place":{"label":"Lisboa","lat":38.72,"lng":-9.14,"source":"search"},"date":"2026-05-10","lang":"en"}}'
```
