Real-world API examples
Try synthetic examples immediately or run the same workflows against the live ShinrAI API.
Synthetic by default
See the workflow before using a key
Every scenario starts with a recorded synthetic result and makes no API request. Switch to live mode when you want to use your own key and allowance.
Your key stays in this page's memory and is cleared on reload. Successful live requests consume records.
Protect a support message
Replace a customer identity before sending the case to an external assistant, then restore the reply locally.
Original→Protected→Restored reply{"protected":"Nora Winter needs help with order 4815.","restored_reply":"Emma Weber can reset order 4815."}Run it yourself
Prerequisites
Set SHINRAI_API_KEY and optionally SHINRAI_API_URL. Use synthetic support text only while testing.
Command
curl "${SHINRAI_API_URL:-https://api.shinrai.innovius.io}/v1/redact" -H "Authorization: Bearer $SHINRAI_API_KEY" -H "Content-Type: application/json" -d '{"text":"Emma Weber needs help with order 4815.","mode":"replace","include_mapping":true}'Expected result
The response contains protected text, a local mapping, detected entities, and usage. Use the mapping in your application to restore the assistant reply.
Troubleshooting
A failed protection response must stop onward delivery. Check the error envelope for invalid credentials, allowance, payload size, or unavailable processing.
Protect CRM records consistently
Use one request-local map so the same person receives the same replacement across records.
{"texts":["Nora Winter owns account A-17.","Email Nora Winter at nora@example.net"],"mapping":{"Emma Weber":"Nora Winter"}}Run it yourself
Prerequisites
Set SHINRAI_API_KEY; export only synthetic CRM rows during evaluation.
Command
curl "${SHINRAI_API_URL:-https://api.shinrai.innovius.io}/v1/redact/batch" -H "Authorization: Bearer $SHINRAI_API_KEY" -H "Content-Type: application/json" -d '{"texts":["Emma Weber owns A-17.","Email Emma Weber at emma@example.com."],"mode":"replace","include_mapping":true}'Expected result
Both results reuse the same replacement for Emma Weber, and the response returns one request-local mapping plus aggregate usage.
Troubleshooting
Send related records in one batch. Separate requests only stay consistent when your application supplies the earlier mapping.
Protect context before an AI request
Send protected retrieval context to the model and keep the replacement map in your application.
Retrieved context→ShinrAI→AI→Local restore{"model_input":"Summarize Nora Winter's account.","restored_reply":"Emma Weber's account is ready for review."}Run it yourself
Prerequisites
Set the ShinrAI key plus MODEL_ENDPOINT, MODEL_NAME, and MODEL_API_KEY for an OpenAI-compatible endpoint.
Command
curl -O https://shinrai.innovius.io/downloads/examples/shinrai-ai-workflow-python.py
SHINRAI_API_KEY=... MODEL_ENDPOINT=https://model.example/v1 MODEL_NAME=your-model MODEL_API_KEY=... python shinrai-ai-workflow-python.pyExpected result
The script prints protected model input and a locally restored reply. The replacement mapping never enters the model request.
Troubleshooting
If protection fails, the script exits before calling the model. Confirm both endpoints and credentials independently, then retry with synthetic context.
Text protection guide · API operation · Python example · JavaScript example · Open WebUI
Protect a document
Upload a synthetic TXT, PDF, or DOCX file, follow its job, and retrieve the protected artifacts.
{"status":"succeeded","artifacts":{"text":"/v1/documents/jobs/demo/artifacts/text","pdf":"/v1/documents/jobs/demo/artifacts/pdf"}}Run it yourself
Prerequisites
Create a synthetic TXT, PDF, or DOCX file and set SHINRAI_API_KEY.
Command
curl -i -X POST "${SHINRAI_API_URL:-https://api.shinrai.innovius.io}/v1/documents/jobs?mode=replace&include_mapping=true" -H "Authorization: Bearer $SHINRAI_API_KEY" -H "Content-Type: text/plain" --data-binary @sample.txtExpected result
A 202 response returns the job ID and Location. Poll that URL until succeeded, then download the listed artifacts.
Troubleshooting
Honor Retry-After while polling. A deployment can reject unsupported file types or artifact formats; inspect the job error before retrying.
Run the full AI workflow locally
The downloadable examples call ShinrAI, pass only protected text to an OpenAI-compatible model endpoint, and restore the reply locally. Model and ShinrAI credentials come from environment variables.