Skip to main content

Segment Optimization

After a segment is live, you can refine it by expanding its reach or blocking unwanted inventory. Submit an optimization request specifying what to add or exclude, and Classify will update the segment accordingly.

Propagation delay

Segment changes are applied within 2–3 hours, but previously targeted URLs and domains may continue to appear for up to one week while SSP and DSP filters phase out old targeting.


The optimization object

{
"id": 87,
"segment_id": 61,
"status": "accepted",
"expand": {
"urls": ["https://www.wsj.com/articles/ev-battery-supply-chain"],
"domains": ["electrek.co"]
},
"block": {
"urls": ["https://clickbait-site.com/article-123"],
"domains": ["clickbait-site.com"],
"keywords": ["gambling", "crypto"]
},
"estimated_propagation_hours": 3,
"created_date": "2026-02-16T14:30:00Z"
}
FieldTypeDescription
idintegerUnique identifier for this optimization request
segment_idintegerThe segment being optimized
statusstringaccepted on success
expandobject | nullURLs and domains submitted to find similar content
blockobject | nullURLs, domains, and keywords to exclude from the segment
estimated_propagation_hoursintegerHours until the change is reflected in the segment. Typically 3.
created_datestring (ISO 8601)When the optimization request was submitted

Optimize a segment

POST https://api.clsfy.me/v1/clsfy/optimizations

Include at least one of expand or block in your request. You can submit both in a single call.

Parameters

ParameterTypeRequiredDescription
segment_idintegerRequiredThe segment to optimize. Must have status: "complete".
expandobjectOptionalNew seed content for the segment to find similar URLs.
expand.urlsarray[string]OptionalURLs representing the kind of content you want more of.
expand.domainsarray[string]OptionalDomains representing the kind of content you want more of.
blockobjectOptionalContent to exclude from the segment.
block.urlsarray[string]OptionalSpecific URLs to remove.
block.domainsarray[string]OptionalEntire domains to remove.
block.keywordsarray[string]OptionalKeywords — any URL whose content matches will be excluded.

Request — Expand

Add new seed URLs and domains to broaden the segment.

curl -X POST "https://api.clsfy.me/v1/clsfy/optimizations" \
-H "X-API-Key: <your_api_key>" \
-H "Content-Type: application/json" \
-d '{
"segment_id": 61,
"expand": {
"urls": [
"https://www.wsj.com/articles/ev-battery-supply-chain",
"https://techcrunch.com/2026/01/10/solid-state-batteries/"
],
"domains": ["electrek.co", "insideevs.com"]
}
}'

Request — Block

Remove unwanted inventory from the segment.

curl -X POST "https://api.clsfy.me/v1/clsfy/optimizations" \
-H "X-API-Key: <your_api_key>" \
-H "Content-Type: application/json" \
-d '{
"segment_id": 61,
"block": {
"urls": ["https://clickbait-site.com/article-123"],
"domains": ["clickbait-site.com", "spam-news.net"],
"keywords": ["gambling", "crypto"]
}
}'

Request — Expand and block together

You can expand and block in a single request.

curl -X POST "https://api.clsfy.me/v1/clsfy/optimizations" \
-H "X-API-Key: <your_api_key>" \
-H "Content-Type: application/json" \
-d '{
"segment_id": 61,
"expand": {
"urls": ["https://www.wsj.com/articles/ev-battery-supply-chain"],
"domains": ["electrek.co"]
},
"block": {
"domains": ["clickbait-site.com"],
"keywords": ["gambling"]
}
}'

Response

Returns the optimization object immediately with status: "accepted".

{
"id": 87,
"segment_id": 61,
"status": "accepted",
"expand": {
"urls": ["https://www.wsj.com/articles/ev-battery-supply-chain"],
"domains": ["electrek.co"]
},
"block": {
"domains": ["clickbait-site.com"],
"keywords": ["gambling"]
},
"estimated_propagation_hours": 3,
"created_date": "2026-02-16T14:30:00Z"
}
No polling needed

Unlike segment creation and activation, optimization requests do not require polling. The response confirms the request was accepted. The segment will be updated within the estimated_propagation_hours window.


Get an optimization

Retrieve a previous optimization request by ID.

GET https://api.clsfy.me/v1/clsfy/optimizations/{id}
ParameterTypeDescription
idintegerThe optimization ID returned at creation
curl "https://api.clsfy.me/v1/clsfy/optimizations/87" \
-H "X-API-Key: <your_api_key>"

Error responses

When a request fails, the API returns a JSON object with an error code and a human-readable message:

{
"error": "not_found",
"message": "Segment with ID 999 not found"
}

HTTP status codes

StatusMeaning
200 OKSuccess
201 CreatedResource created (POST endpoints)
400 Bad RequestInvalid or missing parameters
401 UnauthorizedMissing or invalid API key
404 Not FoundResource not found
422 Unprocessable ContentValidation error (e.g. invalid field values)
429 Too Many RequestsRate limit exceeded