New Affirmations API

New Affirmations API

We are excited to announce the launch of our brand-new Affirmations API, designed to provide easy access to a vast collection of motivational quotes and phrases. This API offers developers and users alike a powerful tool for integrating positive affirmations into various applications and services.

The Affirmations API provides three main endpoints:

  1. /v1/affirmations/categories
  2. /v1/affirmations/categories/{category}/random
  3. /v1/affirmations/random

These endpoints allow users to retrieve affirmations categorized by theme, find a random affirmation within a specific category, or receive a completely random affirmation from our extensive database.

Getting Started

To start using the Affirmations API, you can subscribe at the following URL:

Affirmations API by APIRobots

Once subscribed, you’ll receive your API key, which you’ll need to authenticate your requests.

API Endpoints

1. Get All Categories

Endpoint: GET /v1/affirmations/categories

This endpoint returns a list of all available categories for affirmations.

Example Response:

{
	"items": [
		"love",
		"health",
		"beauty",
		"gratitude",
		"spiritual",
		"happiness",
		"money",
		"blessing",
		"sleep"
	]
}

2. Get an Affirmation by Category

Endpoint: GET /v1/affirmations/categories/{category}/random

Parameters:

  • category (path parameter): The category of the affirmation you want to retrieve

This endpoint returns a single affirmation that matches the specified category.

Example Response:

{
	"text": "I make decisions that come from my heart",
	"category": "love"
}

3. Get a Random Affirmation

Endpoint: GET /v1/affirmations/random

This endpoint returns a random affirmation from our extensive collection.

Response Schema:

{
  "text": {
    "type": "string"
  },
  "category": {
    "type": "string"
  }
}

Example Response:

{
	"text": "I am free spirited and positive.",
	"category": "beauty"
}

Error Handling

The API uses standard HTTP status codes to indicate the success or failure of requests:

  • 200 OK: Successful request
  • 400 Bad Request: Invalid input
  • 401 Unauthorized: Authentication failed
  • 403 Forbidden: Access denied
  • 404 Not Found: Resource not found

Best Practices

  1. Always include your API key in the header of your requests.
  2. Handle errors gracefully in your application logic.
  3. Cache responses when appropriate to reduce API calls and improve performance.
  4. Consider implementing rate limiting on the client side to avoid overwhelming the server.

Conclusion

The new Affirmations API provides a simple yet powerful way to integrate positive affirmations into your projects. Whether you’re building a personal development app, creating a mindfulness platform, or simply looking to add inspiring quotes to your website, this API has got you covered. Start exploring today and watch your users benefit from these uplifting messages!

Try our Affirmations API today!