API Documentation

Ad Generation

Use these endpoints to generate and retrieve ads. All endpoints require an API key in the x-api-key header.

POSThttps://dynamicads.app/api/ads/generate

Generate a new ad

# Example request
curl -X POST https://dynamicads.app/api/ads/generate \
  -H "Content-Type: application/json" \
  -H "x-api-key: your-api-key" \
  -d '{
    "prompt": "Create a dynamic product showcase",
    "mediaType": "video",
    "dimensions": {
      "width": 672,
      "height": 384
    }
  }'

# Example response
{
  "id": "80ae9496-4675-4067-892f-ae3d72927ca5",
  "status": "processing",
  "dimensions": {
    "width": 672,
    "height": 384
  },
  "prompt": "Create a dynamic product showcase",
  "usage": {
    "currentUsage": 8,
    "limit": 10
  }
}
GEThttps://dynamicads.app/api/ads/:id

Get ad status and details

# Example request
curl https://dynamicads.app/api/ads/80ae9496-4675-4067-892f-ae3d72927ca5 \
  -H "x-api-key: your-api-key"

# Example response
{
  "id": "80ae9496-4675-4067-892f-ae3d72927ca5",
  "status": "complete",
  "mediaUrl": "https://dynamicads.app/media/videos/2024/12/08/20241208230240_1733698960671.gif",
  "voiceUrl": "https://dynamicads.app/media/audio/2024/12/08/20241208230247_-1461271707.mp3",
  "componentCode": "function DynamicMediaAd(props) { ... }",
  "voiceScript": "Looking for a better way...",
  "prompt": "Create a dynamic product showcase",
  "dimensions": {
    "width": 672,
    "height": 384
  },
  "mediaType": "video"
}
POSThttps://dynamicads.app/api/ads/list

List all ads for an API key

# Example request
curl -X POST https://dynamicads.app/api/ads/list \
  -H "Content-Type: application/json" \
  -H "x-api-key: your-api-key" \
  -d '{"apiKey": "your-api-key"}'

# Example response
{
  "ads": [
    {
      "id": "80ae9496-4675-4067-892f-ae3d72927ca5",
      "status": "complete",
      "mediaUrl": "https://dynamicads.app/media/videos/...",
      "voiceUrl": "https://dynamicads.app/media/audio/...",
      "componentCode": "function DynamicMediaAd(props) { ... }",
      "voiceScript": "Looking for a better way...",
      "prompt": "Create a dynamic product showcase",
      "dimensions": {
        "width": 672,
        "height": 384
      },
      "mediaType": "video"
    }
  ],
  "total": 1,
  "page": 1,
  "hasMore": false
}