Skip to content

Quickstart

Open the Developer Portal in the AfterLib app, create an API key, and store the full al_live_... value somewhere secure.

API keys are shown once. If a key is exposed, revoke it and create another one.

Terminal window
export AFTERLIB_API_KEY="al_live_replace_me"
curl https://api.afterlib.com/v1/account \
-H "Authorization: Bearer $AFTERLIB_API_KEY"
Terminal window
curl https://api.afterlib.com/v1/credits \
-H "Authorization: Bearer $AFTERLIB_API_KEY"
Terminal window
curl https://api.afterlib.com/v1/ads/search \
-H "Authorization: Bearer $AFTERLIB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "running shoes",
"limit": 10
}'

List collections first:

Terminal window
curl https://api.afterlib.com/v1/collections \
-H "Authorization: Bearer $AFTERLIB_API_KEY"

Then read ads from a collection:

Terminal window
curl "https://api.afterlib.com/v1/collections/00000000-0000-0000-0000-000000000000/items?itemType=ads&limit=25" \
-H "Authorization: Bearer $AFTERLIB_API_KEY"

Add an ad to a collection:

Terminal window
curl https://api.afterlib.com/v1/collections/00000000-0000-0000-0000-000000000000/items \
-X POST \
-H "Authorization: Bearer $AFTERLIB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"itemType": "ads",
"itemId": "1234567890"
}'

The collections guide covers page collections and idempotent add behavior.

  • Use examples and recipes for plain JavaScript, TypeScript, and Python examples.
  • Use request logs when a response includes an error or an unexpected credit charge.
  • Use the API reference for exact request and response fields.