Prediction Endpoints

A Nyckel prediction endpoint is a REST API endpoint that accepts an input and returns a prediction with a confidence score. Each function (model) you create in Nyckel gets its own endpoint.

Invoke URL structure

POST https://www.nyckel.com/v1/functions/{functionId}/invoke

The functionId is found in the Nyckel console on your function’s details page.

Request format

Send the input as a JSON body with a data field.

Text input:

POST /v1/functions/{functionId}/invoke
Authorization: Bearer {token}
Content-Type: application/json

{ "data": "My subscription was cancelled without notice." }

Image input (URL):

POST /v1/functions/{functionId}/invoke
Authorization: Bearer {token}
Content-Type: application/json

{ "data": "https://example.com/photo.jpg" }

Tabular input:

POST /v1/functions/{functionId}/invoke
Authorization: Bearer {token}
Content-Type: application/json

{
  "data": {
    "age": 34,
    "plan": "pro",
    "logins_last_30d": 2
  }
}

Response format

Every invoke response includes labelName, labelId, and confidence:

{
  "labelName": "Churn risk",
  "labelId": "label_abc123",
  "confidence": 0.88
}

If you send an externalId with the request, it is echoed back on the response and travels with the sample if the invoke is captured for review. Do that for any prediction whose true label you might learn later — it ties the prediction to your own record and deduplicates the feedback you submit. See Build a feedback loop.

HTTP status codes

Code Meaning
200 Prediction returned successfully
401 Missing or invalid access token
404 Function ID not found
429 Rate limit exceeded — back off and retry
5xx Server error — retry with exponential backoff
NoteNyckel does not store image data beyond what is needed for training. See the Privacy Policy for details.