Quickstart

Your first cited interpretation.

From zero to a cited answer in minutes.

1. Mint an API key

In the PLCs.ai app, open Settings → API Keys, click Create key, and give it the ai_explain (Interpret & explain) scope. Copy the secret — it is shown exactly once.

export PLCS_API_KEY=plck_live_xxxxxxxxxxxxxxxxxxxxxxxx
export PLCS_PROJECT_ID=prj_your_project_id

2. Install an SDK (optional)

bash
pip install plcsai
bash
dotnet add package PlcsAi

3. Get a cited answer

Using an example question — "What conditions must be true for the main conveyor to start?"

bash
curl -s -X POST "https://app.plcs.ai/api/v1/projects/$PLCS_PROJECT_ID/interpret" \
  -H "Authorization: Bearer $PLCS_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "prompt": "What conditions must be true for the main conveyor to start?",
    "mode": "sync",
    "include_citations": true
  }'
python
from plcsai import Client

client = Client(api_key="plck_live_…")

result = client.interpret(
    project_id="prj_…",
    prompt="What conditions must be true for the main conveyor to start?",
)
print(result.answer)
print(result.citations)
print(result.request_id)
csharp
using PlcsAi;

var client = new PlcsClient("plck_live_…");

var result = await client.InterpretAsync(
    projectId: "prj_…",
    prompt: "What conditions must be true for the main conveyor to start?");

Console.WriteLine(result.Answer);
Console.WriteLine(result.RequestId);

4. The response

json
{
  "answer": "The main conveyor starts when the Start pushbutton is pressed, no E-Stop is active, and the upstream Ready interlock is set …",
  "citations": ["Routine:ConveyorControl/Rung:12", "Tag:Conveyor_Start_PB"],
  "usage": { "input_tokens": 1840, "output_tokens": 412 }
}

Want tokens as they generate? Set "mode": "stream" and read the SSE events — see Streaming.