Generation Endpoints

Get Generation by ID

Endpoint:
GET /api/v1/generations/:id

Retrieve the generated 3D rotating product video for a specific generation by its unique ID. This endpoint supports video streaming with HTTP range requests for efficient playback and download.


Authentication

All requests require an API key.
Include your API key in the Authorization header as a Bearer token:

Authorization: Bearer YOUR_API_KEY

URL Parameters

  • id (string, required): The unique identifier of the generation you want to retrieve.

Example:
GET /api/v1/generations/123


Request Headers

HeaderValueRequiredDescription
AuthorizationBearer YOUR_API_KEYYesYour API key for authentication
Rangebytes=start-end (optional)NoFor partial content streaming (see below)

Response

  • 200 OK: Returns the full video file (for small files).
  • 206 Partial Content: Returns a chunk of the video file (when using the Range header or for large files).
  • 404 Not Found: If the generation or video does not exist, or if the video has expired (older than 1 hour).
  • 410 Gone: If the video has expired (older than 1 hour).

Response Headers

  • Content-Type: video/mp4
  • Content-Length: <number>
  • Accept-Ranges: bytes
  • Content-Range: bytes <start>-<end>/<total> (for partial content)

Video Expiry

  • Videos are only available for 1 hour after creation.
  • Requests for videos older than 1 hour will return an error.

Example: Download Full Video

curl -H "Authorization: Bearer YOUR_API_KEY" \
     https://rotateproduct.com/api/v1/generations/123 --output video.mp4

Example: Stream Video with Range Header

To stream or resume a download, use the Range header:

curl -H "Authorization: Bearer YOUR_API_KEY" \
     -H "Range: bytes=0-1048575" \
     https://rotateproduct.com/api/v1/generations/123 --output video-part.mp4

Error Responses

Not Found

{
  "success": false,
  "error": {
    "code": 4006,
    "message": "video not found",
    "meta": {
        "friendlyMessage": "video not found",
        "type": "error",
        "title": "Video Not Found",
        "resource": "video",
        "id": "999"
    }
  }
}

Expired

{
  "success": false,
  "error": {
    "code": 6001,
    "message": "Generation expired",
    "meta": {
        "friendlyMessage": "Generation expired",
        "type": "error",
        "title": "Generation Expired",
        "id": "271"
    }
  }
}

Best Practices

  • Save your video promptly. Videos are deleted after 1 hour for privacy and storage efficiency.
  • Use range requests for large files or streaming playback.
  • Handle 404 and 410 errors gracefully in your application.

FAQ

Q: What happens if I request a video after 1 hour?
A: The API will return an error indicating the video has expired. You will need to generate a new video.

Q: Can I download the video multiple times within the hour?
A: Yes, you can access and download the video as many times as you need within the 1-hour window.

Q: How do I stream the video in a browser or player?
A: Use a video player that supports HTTP range requests, or serve the video URL directly to compatible clients.


For more help, contact info@rotateproduct.com.

Previous
List Generations