# Caching

> Conditional requests with ETag and If-None-Match.

Source: https://api.tailend.dev/docs/caching

Every successful `/v1` response carries an `ETag`. Send it back as `If-None-Match` on your next request to the same resource, and an unchanged answer costs a `304` with no body:

```bash
curl -sS -D - -o /dev/null -H "X-API-Key: $TAILEND_API_KEY" \
  -H 'If-None-Match: W/"TD64uXep9BDu_tA9n6OF_Zwl3IA"' \
  https://api.tailend.dev/v1/philadelphia/events
# HTTP/1.1 304 Not Modified
```

Responses are `private` — cacheable only by you, never a shared cache — and vary by key. Follow `Cache-Control` for how long to hold a response before revalidating; `/v1/changes` is the one exception, always revalidate it rather than trusting a cached copy.

## What to do

- Store the `ETag` alongside the response body and send it back as `If-None-Match` on your next request for the same resource.
- A `304` still counts as a request — see [Limits & usage](https://api.tailend.dev/docs/limits-and-usage.md).
- See the [API reference](https://api.tailend.dev/docs/api.md) for every header this API sends.
