Skip to content
DaneshyarDocs
Sign in
  • Introduction
  • Quickstart
  • What is Daneshyar?
  • The Apps page
  • Inside an app
  • Workspace: files and chat
  • Sharing and members
  • Notes and dictation
  • Language practice
  • Appointment booking
  • Automations
  • The file reader
  • Your profile
  • Wallet
  • Customer chats
  • API keys
  • Authentication
  • Apps, workspaces, resources
  • Ingestion
  • Chat and sessions
  • Citations
  • Skills
  • Conventions
  • Workspaces
  • Resources
  • Chat
  • Skills
  • Errors
  • Customer support assistant
  • Internal knowledge base
  • Documentation chatbot
  • Academy tutor
  • Embedded widget
  • Widget configuration
  • Framework guides
  • Security
  • Troubleshooting
  • FAQ
  1. Docs
  2. Security and help
  3. Security

Security

Where each of your two keys may live, what protects it, and a checklist before you go live.

Daneshyar has three kinds of credential. Each one is safe in one place only.

Server keys and browser keys

Use this table to decide where each one goes:

Where you send itWho uses itRule
X-API-KeyYour server, calling the REST API (/v1).Secret. Keep it in a server environment variable or a secret manager. Never send it to a browser.
data-api-keyThe widget on your public pages.Public. Anyone can read it. It is a separate widget key (pk_…) that can only ask questions.
Authorization: BearerThe Daneshyar console, after you sign in.Handled by the console. It does not work with /v1, and you never need to copy it.

Securing the widget key

The widget key is public, but it can only ask questions. It cannot use the REST API, list or download files, show which document an answer came from, or change anything.

Another website cannot use it: the browser and our server both check your allowed domains. A script outside a browser can still pretend to be your site, so do these four things:

  1. Know the limits that protect you: questions are rate-limited per visitor and per app, a question can be at most 2,000 characters, and every answer is paid from your wallet. Turn the widget on only for the workspace you embed.
  2. Upload only documents you would be happy to publish. Never put patient records or private files in it.
  3. Add only your real sites to the allowed domains. Every other site is blocked by default.
  4. Never put the secret key (sk_…) in a snippet or any front-end code. If a widget key is misused, press Regenerate for the widget key.

What allowed domains protect

Allowed domains are checked twice. The browser enforces a frame-ancestors rule on the widget page, and our server checks every question against the list. All sites are blocked by default: an empty list allows none.

  • It does stop: another website showing your widget to its visitors, or calling the widget API from its pages, and so spending your wallet.
  • It does not fully stop: a script outside a browser (for example curl) that copies the widget key and fakes the page address. No public key can prevent that. The rate limits — per visitor and per app — cap what it can cost you.

How to write entries: Allowed domains.

Rate limits

The widget has three limits: 20 questions an hour per IP address, 500 a day per app, and 60 loads an hour per IP address. Details are in Limits and costs.

The REST API (/v1) limits only uploads (60 an hour) and retries (30 an hour); other calls have no limit yet. If you put it behind your own endpoint, add your own limit there, per user, so one person cannot use all your credits.

CORS

CORS is a browser rule. It decides which websites may call an API from JavaScript.

  • The widget does not need CORS from you. It runs on Daneshyar's own site, inside the iframe.
  • Calling /v1 from your own website's JavaScript is blocked by CORS. That is on purpose: call it from your server.
  • If your site sends a Content-Security-Policy, allow the widget's site in script-src and frame-src, or the browser blocks the script and the iframe.

Rotating and revoking a keyOn the roadmap: Soon

Open the app page in the console. Each key — widget and secret — has its own Regenerate and Delete buttons. The old key stops working at once.

If a key leaks, regenerate that key right away. A new secret key goes in your server; a new widget key goes in your snippet. Until you swap it in, that part is off.

Checklist before you go live

  1. Your secret key (sk_…) is only in server environment variables, and not in Git or any front-end code.
  2. The widget uses its own app, which holds only public documents.
  3. The allowed domains list has your real sites only, and no leftover test domains.
  4. Your own chat endpoint, if you have one, has a rate limit and sends one external_user_id per user.
  5. Your site's Content-Security-Policy allows the widget's script and iframe.
  6. You know who to contact if a key leaks.
PreviousFramework guidesNextTroubleshooting

On this page

  • Server keys and browser keys
  • Securing the widget key
  • What allowed domains protect
  • Rate limits
  • CORS
  • Rotating and revoking a key
  • Checklist before you go live

Every example on this site runs against the live API. If one doesn't, tell us — that's a bug in the docs.

ServicesAboutTalk to us