# Random Ad

Sometimes you just need a random ad from one of your categories. So instead of using the embed API you can also use this. It's basically the same, just with a different endpoint.

# Get a random ad

Endpoint: https://sublimeads.com/api/random

Type: GET

Add your API token in the token parameter and then go ahead and pass in your public id of your category as the id parameter:

https://sublimeads.com/api/random?token=YOUR_API_TOKEN&id=YOUR_CATEGORY_PUBLIC_ID

If it's valid and you have an active subscription, or you are within your usage limits, your response will look like this:

{
  "message": "Here is your freshly brewed tea... I mean ad.",
  "ad": {
    "public_id": "IhWUDHrlMQPLzQ",
    "image_url": "https://assets.sublimeads.com/i8400v010pykfxrpmmvk65xufo5k",
    "alternative_image_url": "https://sublimeads.com/images/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBJZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--0877acc1ed8ba789abac0cdd9d08aa022820ea6d/some-nice-image.jpg",
    "title": "Sublime Ads",
    "content": "\u003cdiv\u003eA privacy focused \u003cstrong\u003ead management\u003c/strong\u003e service for your apps, websites and others.\u003c/div\u003e",
    "plain_content": "A privacy focused ad management service for your apps, websites and others.",
    "redirect_to_url": "https://sublimeads.com",
    "url": "https://sublimeads.com/tap/IhWUDHrlMQPLzQ/8V17X0nQLpm3iQ",
    "is_paused": false
  }
}

For more information on the ad object, you read more about it here.

Only one random ad is returned within the chosen category.

This works in a similar way as the Embed API option. However, this is tied to your API key which might be useful.

Last updated: 1/30/2021, 10:21:35 PM