Skip to content

bacf5/ducks-api

Repository files navigation

Ducks-Facts API 🦆

image

Deployment status:‎ ‎ Netlify Status


This API provides a simple way to access interesting and random facts. The API will have images available soon. Now has high quality images to deliver!

Getting Started

To start using the ducks-facts API, you'll first need to register to obtain an API key. This key will be used to authenticate your requests and track your usage.

base url: https://duck-api.netlify.app

Register for an API Key

To register for an API key, fill out the form on our website. You’ll receive your key by email.

image

{
  "message": "Registration successful!",
  "apiKey": "YOUR_NEWLY_GENERATED_API_KEY",
  "initialCredits": 500
}

Authentication

All authenticated endpoints require your API key to be sent in the X-api-key header of your HTTP requests.

Example Header:

X-api-key: YOUR_API_KEY_HERE

Endpoints

1. Get a Random Fact

GET /api/facts/random

This endpoint returns a random, interesting fact. You must provide your API key in the request headers.

Headers:

  • X-api-key: Your API key.
{
  "id": 54,
  "fact": "Most duck species are monogamous for a breeding season but typically find new mates each year."
}

2. Check API Usage

GET /api/usage

This endpoint allows you to check your remaining API credits. You must provide your API key in the request headers.

Headers:

  • X-api-key: Your API key.
{
  "message": "API usage details",
  "remainingCredits": 481
}

3. Get a Random Image

GET /api/image/random

This endpoint allows you to get a random image. You must provide your API key in the request headers.

Headers:

  • X-api-key: Your API key.
{
  "id": 32,
  "url": "https://ik.imagekit.io/duckapi/32.jpg"
}

Next steps

  • Add some high-quality duck images
  • Expand API endpoints for image delivery
  • The chance to add custom duck facts into the API
  • Community image upload
  • Posibility to search image and fact by id

Attributions

About

Fetch random duck facts with a simple API call.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published