Prompt
What should I use for an API that has historical and current data?
Latest observation
Oct 17, 2026
OpenAI APIWeb search: off
If your API needs to serve both current and historical data, a good default choice is:
Recommended pattern
Use one resource model with:
- a current/latest endpoint for the present state
- time-based query parameters or a history subresource for past versions
Common designs
1) Current data endpoint
GET /items/{id}
Returns the latest version by default.
2) Historical data endpoint
GET /items/{id}/history
Returns all past versions or change records.
3) Point-in-time lookup
GET /items/{id}?at=2026-10-17T12:00:00Z
Returns the version valid at that timestamp.
When to use each
- Use
/historyif you want audit-style changes or version records. - Use
?at=or?version=if clients need to ask “what was this at a specific time?” - Use separate endpoints if historical data has a different shape or volume from current data.
Best practice
If possible, make the API:
- RESTful
- time-aware
- explicit about versioning
A solid design is:
GET /resource/{id} -> current data
GET /resource/{id}/history -> historical versions
GET /resource/{id}?at=... -> data at a specific time
If you want, I can suggest the best design based on your exact use case, like whether this is for metrics, prices, user records, or audit logs.