Skip to content
Madly.

Developers / Madly

Build with Madly.

Create ad sets and carousels from your own code. Calls use your workspace's credits, and nothing is published to ad platforms.

Quick start

  1. Create a key. In Madly, open Settings, then API keys, and choose Create key. Only admins can. Copy the key; it is shown once.
  2. Add a product from its page.
curl https://admadly.com/api/v1/products \
  -H "Authorization: Bearer mad_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/shop/candle"}'
  1. Create an ad set with the product's id. You get an id back straight away.
curl https://admadly.com/api/v1/ad-sets \
  -H "Authorization: Bearer mad_live_your_key" \
  -H "Idempotency-Key: first-candle-ads" \
  -H "Content-Type: application/json" \
  -d '{"product_id": "<id from the last step>"}'
  1. Check the ad set about once every 20 seconds until ready is true. It usually takes about a minute.
curl https://admadly.com/api/v1/ad-sets/<id> \
  -H "Authorization: Bearer mad_live_your_key"

Authentication

Send your key as a bearer token on every request: Authorization: Bearer your-key.

A key belongs to one workspace and can only reach that workspace's products, ad sets and credits. Revoke it in Settings at any time and it stops working at once. Keep keys out of web pages and public code.

Endpoints

All paths start with https://admadly.com/api/v1.

MethodPathWhat it does
GET/productsList products
POST/productsAdd a product from a URL
POST/ad-setsCreate an ad set
GET/ad-sets/{id}Get an ad set
POST/idea-carouselsCreate an idea carousel
GET/idea-carousels/{id}Get an idea carousel
GET/creditsGet credits

Errors

Failed calls return a status code and a body like this.

{ "error": { "code": "invalid_request", "message": "Give a product_id from listProducts." } }
StatusCodeMeaning
400invalid_requestSomething in the request is missing or not valid.
401unauthenticatedThe key is missing, wrong or revoked.
402insufficient_creditsThe workspace does not have enough credits.
403forbiddenThe key cannot do this in its workspace.
404not_foundThere is nothing with that id in the workspace.
409idempotency_in_progressA request with the same Idempotency-Key is still running.
422idempotency_key_reusedThat Idempotency-Key was used with a different request.
429rate_limitedToo many requests. Wait for the time in Retry-After.

Retrying safely

Add an Idempotency-Key header to any POST. Repeat the same request with the same key and you get the first answer back, with no second product, ad set or charge. Use 8 to 128 letters, numbers, dashes or underscores. Keys are remembered for 24 hours.

Rate limits

Each key can make 60 requests a minute, and 10 of those can be calls that create something. Every answer carries RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset (seconds until the allowance refills). Past the limit you get a 429 with a Retry-After header.

Credits

API calls use the same credits as the app, from the workspace the key belongs to. Credits are charged as images finish. Check the balance with Get credits, and buy more in Settings under Billing. When credits run out, creating calls return 402.

OpenAPI file

Import the full description into your tools or code generator.

https://admadly.com/api/v1/openapi.json