Skip to content

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/whoami \
-H "Authorization: Bearer $AFTERLIB_API_KEY"

If this returns your AfterLib account, the key is working.

{
"authenticated": true,
"authSource": "api_key",
"user": {
"userId": "00000000-0000-7001-8001-aa0000000001",
"billingUserId": "00000000-0000-7001-8001-aa0000000001",
"name": "Ada Lovelace",
"emailAddress": "ada@example.com",
"planId": "pro",
"isTeamMember": false,
"subscriptionStatus": "active"
},
"apiKey": {
"id": "019e6387-e2e9-7478-9d6d-170158c523b0",
"name": "Claude Desktop",
"keyPrefix": "al_live_abc12345"
},
"oauthClientId": null
}

user.name and user.emailAddress can be null when AfterLib cannot resolve them for the connected account.

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 '{
"search": "running shoes",
"limit": 10
}'

Website Library routes are no-credit in this phase:

Terminal window
curl "https://api.afterlib.com/v1/websites/domains?limit=10&search=running" \
-H "Authorization: Bearer $AFTERLIB_API_KEY"

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, Website Library item types, and idempotent add behavior.

  • Use examples and recipes for plain curl, JavaScript, TypeScript, PHP, and Python examples.
  • Use the websites guide for Website Library domain and link routes.
  • Use request logs when a response includes an error or an unexpected credit charge.