# Ads

Getting your ads is easy. You have the option to retrieve ads depending on category in the categories section of this guide.

# Get all Ads

Endpoint:

https://sublimeads.com/api/ads

Again, pass in your token as a URL parameter.

This will return all of your ads on your account. Here is an example response:

{
	"message":"Here are your ads",
	"count":1,
	"items":[
		{
			"id":34,
			"public_id":"XjtXY7re_kWmLw",
			"image_url":"https://assets.sublimeads.com/1dmbubekywe7h4u3hlcz6a4a650q",
			"title":"Sublime Ads",
			"content":"\u003cdiv\u003eA privacy focused \u003cstrong\u003ead management\u003c/strong\u003e service for your apps, websites and others.\u003c/div\u003e",
			"redirect_to_url":"https://sublimeads.com",
			"url":"https://sublimeads.com/tap/XjtXY7re_kWmLw",
			"is_paused":false
		},
	]
}

Info on the ad object is below.

To keep things easy, the count of ads is also returned. Might be useful.

# Get an Ad by ID

Each ad has its own ID and you can grab an ad individually if so needed.

Endpoint: https://sublimeads.com/api/ad/:id

Note that you replace :id with the ID of the ad you want to grab. Do not use the "public_id" here - it will not work.

The ID of your ad can be found in your ad list.

# The Ad object

Let's break down the Ad object.

{
	"id":34,
	"public_id":"XjtXY7re_kWmLw",
	"image_url":"https://assets.sublimeads.com/1dmbubekywe7h4u3hlcz6a4a650q",
	"title":"Sublime Ads",
	"content":"\u003cdiv\u003eA privacy focused \u003cstrong\u003ead management\u003c/strong\u003e service for your apps, websites and others.\u003c/div\u003e",
	"redirect_to_url":"https://sublimeads.com",
	"url":"https://sublimeads.com/tap/XjtXY7re_kWmLw",
	"is_paused":false
},

# id

The ID of your Ad - useful if you need to grab it individually.

Type: int

# public_id

This is the public facing id of your ad, which will be used for the "tap" redirect found in the "url" field.

Type: string

# image_url

This is the URL of the image.

Type: string

Note that for now, no file extension is returned. I'll work on this! ... don't ask!

# title

The title of your ad.

Type: string

# content

HTML encoded content as set for your ad.

Type: string

# redirect_to_url

This is the URL that is used when redirecting a user to the specific website for the ad. You can use this directly if you so wish and register a "tap" via a POST instead. See the taps section for more info.

In general the user is directed to the Sublime Ads "tap" endpoint where they are then redirected to the redirect_to_url.

Type: string

# url

The URL of the Sublime Ads Tap endpoint. This is the preferred way to handle a click/tap of your ads. Once navigated to this the use will be redirected to the redirect_to_url.

Type: string

When returning Ads from a category this URL changes slightly as we also want to know about the category that it's tied to. See categories for details.

A URL with a tied category will look like this:

http:s//sublimeads.com/tap/XjtXY7re_kWmLw/5c3sO4cNrK2Jlg

To break it down, the first "public_id" is for the ad. The second is the "public_id" for the category.

# is_paused

Tells you if the ad is paused or not.

Type: boolean