Preview segment
POST
/v1/api/sites/{site_id}/segments/preview- Scope
urls:read- Token
- API key or OAuth access token
- Role
- Any workspace member
- MCP tool
preview_segment· preview: MCP write tools are in preview- What scopes, tokens and roles mean →
Request
cURL
curl -X POST "https://api.crawle.io/v1/api/sites/11111111-1111-1111-1111-111111111111/segments/preview" \
-H "Authorization: Bearer $CRAWLE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"Example","conditions":[{"negate":false,"pattern":"example","pattern_type":"contains"}]}'JavaScript
const response = await fetch("https://api.crawle.io/v1/api/sites/11111111-1111-1111-1111-111111111111/segments/preview", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.CRAWLE_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"name": "Example",
"conditions": [
{
"negate": false,
"pattern": "example",
"pattern_type": "contains"
}
]
}),
});
const data = await response.json();Python
import os
import requests
response = requests.request(
"POST",
"https://api.crawle.io/v1/api/sites/11111111-1111-1111-1111-111111111111/segments/preview",
headers={
"Authorization": f"Bearer {os.environ['CRAWLE_API_KEY']}",
},
json={
"name": "Example",
"conditions": [
{
"negate": False,
"pattern": "example",
"pattern_type": "contains"
}
]
},
)
data = response.json()$CRAWLE_API_KEY- is an API key from Settings › API keys.
Response 200: a JSON object. Its fields are not described in the API contract yet, so no example is shown.
Parameters
site_idpath · string (uuid)required
Request body
conditionsarray of SegmentConditionInputrequired- up to 50 items
negateboolean- default false
patternstringrequired- 1–500 characters
pattern_typeenum- one of "contains", "prefix", "suffix", "regex" · default "contains"
namestringrequired- 1–100 characters
match_modeenum- one of "all", "any" · default "all"
Response 200
Returns a JSON object. Its fields are not described in the API contract yet.
Errors
401
- When
- Missing, invalid, or expired token.
403
- When
- The token has none of the accepted scopes (
urls:read).
422
- When
- The request did not match the schema.
detaillists each problem.
429
- When
- Rate limited. Wait for
Retry-Afterseconds.
Generated from the API contract at 7e7039b0b, synced October 30, 2026.