📌 Image
Streams an animated GIF file representing the selected exercise at a specific resolution.
This endpoint returns a GIF for a given exerciseId
and resolution
. The available resolution depends on the user's subscription tier.
Request
Method: GET
URL: https://exercisedb.p.rapidapi.com/image
🔐 Authentication
- Query parameter:
?rapidapi-key=YOUR_API_KEY
- OR request header:
X-RapidAPI-Key: YOUR_API_KEY
🔸 Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
exerciseId | query | string | true | The ID of the exercise to retrieve the GIF for |
resolution | query | enum | true | Must be one of: 180 , 360 , 720 , 1080 (in pixels) |
rapidapi-key | query | string | false | RapidAPI API key |
💻 Example Request
import React from "react";
const ExerciseImage: React.FC<{ exerciseId: string }> = ({ exerciseId }) => {
const apiKey = "YOUR_API_KEY"; // Replace with your actual RapidAPI key
const resolution = "360"; // Adjust based on your user's plan
const imageUrl = `https://exercisedb.p.rapidapi.com/image?exerciseId=${exerciseId}&resolution=${resolution}&rapidapi-key=${apiKey}`;
return (
<img
src={imageUrl}
alt="Exercise animation"
width={resolution}
height="auto"
style={{ borderRadius: "8px" }}
/>
);
};
export default ExerciseImage;
Response
200
- The endpoint returns a streamed GIF image.
- The response is not JSON.
- The
Content-Type
header is always set toimage/gif
. - This endpoint is optimized for direct use in
<img>
tags or client-rendered previews.
📝 Notes
- All images returned by this endpoint are in GIF format.
- Subscription tier access:
- BASIC → access to
180
resolution only - PRO → access to
180
and360
resolutions - ULTRA and MEGA → access to all four resolutions:
180
,360
,720
, and1080
- BASIC → access to
- If a resolution higher than the user's tier is requested, the response defaults to the highest resolution allowed for their plan.
- A
422 Unprocessable Entity
error is returned if:exerciseId
is missing or invalidresolution
is missing or not one of the accepted values
- A
500 Internal Server Error
is returned if:- The image does not exist for the given parameters
- There is a server-side issue retrieving the image
- It is highly recommended to use this endpoint client-side by passing the
rapidapi-key
as a query parameter within an<img>
tag or similar component to ensure smooth streaming and fast rendering.