Hosted API
Send text and your categories in one request. The managed service is in development. To try a preview deployment, use the endpoint and bearer key supplied by its operator.
Classify a sentence
Set CLASSIFY_URL and CLASSIFY_KEY in your server environment. For local development the default URL is http://127.0.0.1:8080.
curl --fail-with-body "$CLASSIFY_URL/v1/classify" \
-H "Authorization: Bearer $CLASSIFY_KEY" \
-H 'Content-Type: application/json' \
-d '{"text":"This is a terrible movie",
"categories":["positive","negative","neutral"]}'
A match returns the category, its score, and "source":"hosted". When no category fits confidently, the request also succeeds and returns this result.
{"status":"unknown","category":null,"score":null,"source":"hosted"}
Handle a failed request
- 400 · Invalid request
- Check the text, categories and settings against the API specification.
- 401 · Unauthorized
- Check the bearer key for this deployment.
- 413 · Request too large
- Keep the JSON payload within 10 MiB.
- 429 · Busy
- Wait for the interval in
Retry-After, then retry. - 503 · Unavailable
- Check
GET /healthbefore retrying.
