Skip to content
MUI’s hosted AI Assistant backend shuts down at the end of 2026.Switch in two lines →
  • Products
    • AG Grid AI Toolkit Early accessThe model and the server behind the toolkit.
    • MUI X Data Grid StableThe backend for the Premium AI Assistant.
    • TanStack Table Public alphaA plugin that applies each answer to your table.
    • AG Studio Early accessA hosted backend for its assistant, not built yet.
  • How it works
  • Accuracy
  • Pricing
  • Security
  • Docs
    • Quickstart: server route
    • Quickstart: TanStack Table
    • Browser keys
    • Moving from MUI’s hosted service
    • Guide: when MUI’s service retires
Sign inStart a 7-day trial
Menu
  • Products
    • AG Grid AI Toolkit Early access
    • MUI X Data Grid Stable
    • TanStack Table Public alpha
    • AG Studio Early access
  • How it works
  • Accuracy
  • Pricing
  • Security
  • Docs
    • Quickstart: server route
    • Quickstart: TanStack Table
    • Browser keys
    • Moving from MUI’s hosted service
    • Guide: when MUI’s service retires
  • Sign in

Product

  • How it works
  • Accuracy
  • Pricing
  • Data and security

Grids

  • AG Grid AI ToolkitEarly access
  • MUI X Data Grid PremiumStable
  • TanStack TablePublic alpha
  • AG StudioEarly access

Docs

  • Quickstart: server route
  • Browser keys
  • Guide: when MUI’s service retires

Company

  • Contact
  • Terms
  • Privacy

Not affiliated with or endorsed by MUI or AG Grid. MUI and AG Grid are trademarks of their respective owners.

© 2026 Gridsay

Docs pages
Start
  • Documentation
  • How it works
  • Examples
MUI X Data Grid
  • Quickstart: server route
  • From the browser
  • Using the helper
  • Filtering
  • Sorting
  • Grouping
  • Aggregation
  • Pivoting
  • Charts
  • Row selection
  • Follow-up questions
  • Refusals and errors
  • Moving from MUI’s service
  • Reference
TanStack Table
  • Quickstart
  • Describing columns
  • Filtering
  • Sorting
  • Grouping
  • Row selection
  • Server-side data
  • Controlled state
  • Undo and reset
  • Refusals and errors
  • API reference
Keys and sign-in
  • Secret and publishable keys
  • Browser keys
  • JWT and OIDC
  • Session tokens
  • Identity webhook
  • Per-user limits
  • The console
  • Data and privacy
HTTP API
  • HTTP API
  • Authentication
  • Data Grid endpoint
  • Follow-up questions
  • Private mode
Reference
  • Errors
  • Limits
  • Tiers and credits
  • @gridsay/core
On this page

On this page

  1. Secret key
  2. Publishable key and the user's token
  3. Allowed origins
  4. What each failure answers
  5. Next
Skip to the article
Start
  • Documentation
  • How it works
  • Examples
MUI X Data Grid
  • Quickstart: server route
  • From the browser
  • Using the helper
  • Filtering
  • Sorting
  • Grouping
  • Aggregation
  • Pivoting
  • Charts
  • Row selection
  • Follow-up questions
  • Refusals and errors
  • Moving from MUI’s service
  • Reference
TanStack Table
  • Quickstart
  • Describing columns
  • Filtering
  • Sorting
  • Grouping
  • Row selection
  • Server-side data
  • Controlled state
  • Undo and reset
  • Refusals and errors
  • API reference
Keys and sign-in
  • Secret and publishable keys
  • Browser keys
  • JWT and OIDC
  • Session tokens
  • Identity webhook
  • Per-user limits
  • The console
  • Data and privacy
HTTP API
  • HTTP API
  • Authentication
  • Data Grid endpoint
  • Follow-up questions
  • Private mode
Reference
  • Errors
  • Limits
  • Tiers and credits
  • @gridsay/core

Authentication

On this page

  1. Secret key
  2. Publishable key and the user's token
  3. Allowed origins
  4. What each failure answers
  5. Next

Every call carries a Gridsay key in the x-api-key header. Which key you use decides where the call may come from. You create both kinds in the console: see Keys.

KeyStarts withCall fromAlso needs
SecretStarts withsk_gs_Call fromYour server onlyAlso needsNothing else. Check your own users before you forward their question.
PublishableStarts withpk_gs_Call fromThe browserAlso needsAn allowed origin and the signed-in user's token.

Keys made earlier start with sk_ayt_ or pk_ayt_ and still work. The key decides the tier that answers; no request field changes it.

Secret key#

Your server forwards the user's question and adds the key. A secret key never appears in browser code.

  • With no allowed origins on the key, any caller with the key is accepted.
  • With allowed origins, the request's Origin header must match one of them. Without Origin, the origin of Referer is used. A request with neither, such as curl or most server code, is refused with 403 origin_not_allowed: send an allowed origin as Origin, or forward the browser's, as the quickstart route does.
  • http://localhost and http://127.0.0.1, on any port, are always accepted on a secret key, for development.
  • options.metadata.referenceId names your user in usage reports. It does not authenticate anyone: your server decides who may ask.

Publishable key and the user's token#

A publishable key can be called from the page itself. Each call also proves who the user is:

  • JWT sign-in and Gridsay session tokens: Authorization: Bearer <token>. See JWT and session tokens.
  • Webhook sign-in: the header you chose for the key. See webhook.
JavaScript
// In a page whose origin is on the key's allowed origins.const response = await fetch('https://api.gridsay.com/api/v1/datagrid/prompt', {  method: 'POST',  credentials: 'omit',  headers: {    'Content-Type': 'application/json',    'x-api-key': 'pk_gs_FAKE_EXAMPLE_DO_NOT_USE',    Authorization: `Bearer ${await getToken()}`,  },  body: JSON.stringify({    query: 'people in Germany or France earning over 100k',    context: JSON.stringify([{ field: 'country' }, { field: 'salary', type: 'number' }]),  }),});const answer = await response.json();if (!answer.ok) throw new Error(answer.message);

The browser sets Origin; your code does not. Cookies are not read: use credentials: 'omit'.

Allowed origins#

A publishable key answers only pages on its allowed origins, and an empty list allows none.

  • An origin is a scheme, a host and an optional port: https://app.example.com. No path, no trailing slash.
  • https://*.example.com allows every subdomain, not https://example.com itself. Scheme and port must match.
  • A publishable key needs the Origin header; Referer alone is not enough, and there is no localhost exception. Add http://localhost:5173 (your own port) to test locally.

The API answers the browser's preflight (OPTIONS) before it reads any key. That is not permission: the POST that follows is checked in full.

What each failure answers#

StatusCodeWhenSend again unchanged?
401Codeinvalid_api_keyWhenThe key is missing, malformed, expired, disabled or unknown.Send again unchanged?No. Check the key.
403Codeorigin_not_allowedWhenThe origin is not on the key's list, the publishable key has no list, a publishable call has no Origin, or a call with a secret key that has a list sends neither Origin nor Referer.Send again unchanged?No. Fix the origin or its settings.
403CodeforbiddenWhenThe publishable key has no sign-in method set up.Send again unchanged?No. Set up sign-in for the key.
401Codeunauthenticated_userWhenThe user's token is missing, cannot be verified, or names no user.Send again unchanged?No. Send a valid user token.
429Coderate_limitedWhenMore than 20 sign-in checks in a minute for this key and client address, counting checks that failed and checks still in progress. A check that succeeds does not count.Send again unchanged?Yes, after the wait.
503Codeupstream_unavailableWhenThe sign-in provider could not be reached, or the saved secret could not be read.Send again unchanged?Yes, later. Check your sign-in settings if the detail names them.

None of these is charged. The sentence and the fix for each code are in Errors.

Next#

  • Browser keys
  • Data Grid endpoint
  • Errors