Skip to content

Collections let members work with saved ad, page, website domain, and website link groups through the AfterLib API.

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

Response:

{
"items": [
{
"id": "019e6387-e2e9-7478-9d6d-170158c523b0",
"name": "Favorites",
"appUrl": "https://app.afterlib.com/collections/019e6387-e2e9-7478-9d6d-170158c523b0",
"type": "private",
"isDefault": true,
"defaultType": "favorites",
"isOwner": true,
"adCount": 1,
"pageCount": 1,
"websiteDomainCount": 1,
"websiteLinkCount": 1
}
]
}

The response includes owned collections, accessible team collections, and visible default-style collections such as favorites when available. Hidden collections are not returned.

ParameterLocationTypeDefaultAllowed valuesDescription
collectionIdpathUUID stringrequiredcollection UUIDThe collection to read.
itemTypequerystringrequiredads, pages, website_domains, website_linksThe kind of item to return.
limitquerynumber501 to 100Maximum items returned.
cursorquerystringnonevalue from previous responseFetch the next cursor page.
Terminal window
curl "https://api.afterlib.com/v1/collections/019e6387-e2e9-7478-9d6d-170158c523b0/items?itemType=pages&limit=50" \
-H "Authorization: Bearer $AFTERLIB_API_KEY"

Response:

{
"collection": {
"id": "019e6387-e2e9-7478-9d6d-170158c523b0",
"name": "Favorites",
"appUrl": "https://app.afterlib.com/collections/019e6387-e2e9-7478-9d6d-170158c523b0",
"type": "private",
"isDefault": true,
"defaultType": "favorites",
"isOwner": true,
"adCount": 1,
"pageCount": 1,
"websiteDomainCount": 1,
"websiteLinkCount": 1
},
"itemType": "pages",
"items": [
{
"pageId": "9000000000500",
"appUrl": "https://app.afterlib.com/pages/9000000000500",
"pageName": "Drift Wellness Company",
"adsAmount": 4,
"performance": 84
}
],
"cursor": null,
"hasMore": false
}

Website domain and website link collection reads are no-credit in this phase. Ad and page collection reads can charge viewing credits for returned unique records.

ParameterLocationTypeDefaultAllowed valuesDescription
collectionIdpathUUID stringrequiredcollection UUIDThe collection to update.
itemTypeJSON bodystringrequiredads, pages, website_domains, website_linksThe item kind.
itemIdJSON bodystringrequiredad UUID, page ID, website domain UUID, or website link UUIDThe item to save.
Terminal window
curl https://api.afterlib.com/v1/collections/019e6387-e2e9-7478-9d6d-170158c523b0/items \
-X POST \
-H "Authorization: Bearer $AFTERLIB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"itemType": "pages",
"itemId": "9000000000500"
}'

Response:

{
"collection": {
"id": "019e6387-e2e9-7478-9d6d-170158c523b0",
"name": "Favorites",
"appUrl": "https://app.afterlib.com/collections/019e6387-e2e9-7478-9d6d-170158c523b0",
"type": "private",
"isDefault": true,
"defaultType": "favorites",
"isOwner": true,
"adCount": 1,
"pageCount": 1,
"websiteDomainCount": 1,
"websiteLinkCount": 1
},
"itemType": "pages",
"itemId": "9000000000500",
"added": true
}

The endpoint is idempotent. If the item already exists in the collection, the response returns added: false. Missing or inaccessible collections return 404 so collection existence is not leaked.