PerslyPersly API

Quickstart

Make your first Persly API call in under 5 minutes.

1. Get an API Key

Sign up at platform.persly.ai and create an API key from your dashboard. Your key will look like:

psl_test_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4

Keep your API key secret. Do not share it or expose it in client-side code.

New accounts receive $5.00 in free credits automatically. Credits are deducted per request. When your balance runs out, purchase more at platform.persly.ai. See Credits & Billing for details.

2. Make Your First Request

curl https://api.persly.ai/v1/chat/completions \
  -H "Authorization: Bearer $PERSLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "persly-chat-v1",
    "messages": [
      {
        "role": "user",
        "text": "What are the common side effects of metformin?"
      }
    ]
  }'
import requests

response = requests.post(
    "https://api.persly.ai/v1/chat/completions",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "model": "persly-chat-v1",
        "messages": [
            {
                "role": "user",
                "text": "What are the common side effects of metformin?",
            }
        ],
    },
)

data = response.json()
print(data["message"])
const response = await fetch("https://api.persly.ai/v1/chat/completions", {
  method: "POST",
  headers: {
    Authorization: "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "persly-chat-v1",
    messages: [
      {
        role: "user",
        text: "What are the common side effects of metformin?",
      },
    ],
  }),
});

const data = await response.json();
console.log(data.message);

3. Understand the Response

Response
{
  "steps": [
    {
      "description": "Searching medical knowledge base",
      "actions": [
        {
          "type": "search_official_source",
          "input": {"query": "metformin common side effects"},
          "result": [
            {
              "title": "Metformin - StatPearls",
              "url": "https://www.ncbi.nlm.nih.gov/books/NBK518983/",
              "content": "Common adverse effects include gastrointestinal symptoms..."
            }
          ]
        }
      ]
    }
  ],
  "message": "Common side effects of metformin include gastrointestinal symptoms such as nausea, diarrhea, and abdominal discomfort...",
  "sources": [
    {
      "title": "Metformin - StatPearls",
      "url": "https://www.ncbi.nlm.nih.gov/books/NBK518983/",
      "relevance_score": 0.95
    }
  ],
  "follow_up_questions": null
}

Key fields:

  • message — The AI response
  • steps — AI processing steps with actions performed
  • sources — Medical references (null when no citations are returned)
  • follow_up_questionsnull by default (include_follow_ups: false), array when enabled and generated

Next Steps

  • Authentication — API key formats and security best practices
  • Models — Compare available models and pricing
  • Streaming — Enable real-time response streaming
  • Domains — Discover valid domain filter values
  • Error Handling — Handle errors gracefully

On this page