Skip to main content

Using API keys with REST requests

You may limit access to your deployed models using API keys. API keys are created in the Settings area of Modelbit, and sent to deployments in the Authorization header.

Using curl

With curl, use the -H flag to set a header:

curl -s -XPOST "https://<your-workspace-url>/v1/example_deployment/latest" \
-H "Authorization: YOUR_API_KEY" \
-d '{"data":[[1,10,11],[2,20,21],[3,30,31]]}'

Using Python

In Python with the requests package, add to the headers= argument:

import json, requests"https://<your-workspace-url>/v1/example_deployment/latest",
"Authorization": "YOUR_API_KEY"