Affirmations API
Random positive affirmations from a simple free API — no key.
What it does
affirmations.dev is a tiny API that returns a single random positive affirmation. One endpoint, no parameters, CORS enabled.
Base URL
Authentication
None. GET / returns {"affirmation": "..."}.
Code examples
curl -s https://www.affirmations.dev/
const { affirmation } = await fetch("https://www.affirmations.dev/")
.then(r => r.json());
document.querySelector("#msg").textContent = affirmation;Rate limits & quotas
No key, no documented rate limit. The affirmation pool is finite, so expect repeats over many calls. Cache one per session or per day rather than fetching on every render.
Key response fields
| affirmation | The affirmation text |
Common errors
| 5xx | Rare — retry or show a bundled fallback affirmation. |
| (repeats) | Small dataset — not a bug. |
When to use it (and alternatives)
A gentle touch for wellness apps, new-tab pages, journaling tools and loading screens. See also Advice Slip and ZenQuotes for related short-text content.
FAQ
Does it work from the browser?
Yes — CORS is enabled, so a direct fetch works with no proxy.
Can I get several at once?
No — it returns one affirmation per call. Loop if you need a few, or cache a batch.
Is it actively maintained?
It is a small community project. Add a local fallback list so your feature still works if the service is down.
New to APIs?
Short guides for working with this API — and any other.