Skip to main content

Access Rational AI via API

Your own applications can call Rational AI's models with an API key. Use this guide to create and manage keys, copy a working code snippet for a model, and give an application a key that reaches only one touchpoint.

What is API access?

An API (Application Programming Interface) is the channel your own applications and scripts use to talk to Rational AI's models directly, instead of a person typing into the chat UI. You prove who you are with an API key (a long secret string you generate in Settings) and send requests to your workspace's gateway.

The gateway is OpenAI-compatible: it accepts the same requests as OpenAI's API, so you can use the standard OpenAI SDKs and existing tools.

Prerequisites​

Before you start, make sure you have:

  • An administrator account to create a workspace key. Other users can open Settings → API Keys if their role has the API Keys row, but only an administrator can create a key.
  • At least one active model. A model configured in the AI Model Registry that you intend to call. See AI Model Registry features if you need to set one up.
  • An HTTP client or OpenAI SDK. For example cURL, the Python OpenAI SDK, or the TypeScript OpenAI SDK.
  • For a touchpoint key: a touchpoint on the API channel, and permission to edit it.

Manage your API keys​

Settings → API Keys lists every key with its name, a masked value, the date it was created, and whether it is Enabled or Disabled.

The API Keys settings page

The API Keys page: create and manage the keys used for programmatic access.

Create an API key​

Give each application, script, or person its own named key, so you can revoke one without disrupting the others.

  1. Go to Settings → API Keys.
  2. Select New (shown as Add new when the list is empty).
  3. In the Generate new key dialog, enter a Name for the key, for example My personal API key.
  4. Select Create.
  5. The Generate new secret key dialog shows the full key. Use the copy button to copy it, store it somewhere safe, then select Done.
The key is shown only once

Once you select Done, the list shows only a masked value and the key can't be shown again. If you lose it, delete the key and generate a new one.

A key from this page acts with administrator rights

Keys created under Settings → API Keys belong to the workspace, not to one application: they authenticate as an administrator, whoever created them, and reach the whole Rational AI API, not only the model gateway and touchpoint APIs. Anyone holding one can read and change everything an administrator can. When an application only needs to talk to one assistant, give it a touchpoint key instead.

Disable or delete an API key​

Disable a key as soon as it is no longer needed or might be compromised.

  1. Go to Settings → API Keys.
  2. Open the menu on the key's row.
  3. Choose what to do:
    • Disable stops the key from authenticating but keeps it in the list, so you can Enable it again later.
    • Edit renames the key.
    • Delete removes it for good. Confirm in the Delete API key dialog.
Deleting is permanent

A deleted key can't be viewed or recovered, and every request that still uses it is rejected. If you only want to stop a key while you investigate, disable it instead.

Call a model​

Find the code for a model​

  1. Open the AI Model Registry and select the model you want to call to open its details drawer.
  2. In the model overview, expand the Use via API section.
  3. Choose the tab for your language:
    • cURL
    • Python (OpenAI SDK)
    • TypeScript (OpenAI SDK)
  4. Use the copy-to-clipboard button on the snippet to copy it.
The Use via API section with code snippets

Use via API: ready-made cURL, Python and TypeScript snippets that call the model through the OpenAI-compatible API.

Each snippet already points at your workspace's gateway, with the model field set to the model's identifier.

Authenticate your requests​

Send the API key as a Bearer token in the Authorization header:

Authorization: Bearer $RATIONAL_AI_API_KEY

Set the RATIONAL_AI_API_KEY environment variable (or your own secret store) to the key value from the one-time secret dialog. The copied snippet reads from that variable, so once it's set the snippet authenticates on its own.

Choose between chat completions and responses​

The gateway accepts both OpenAI APIs, Chat completions and Responses, with the same key and the same base URL. The snippets in the registry use chat completions. Every call is recorded in Governance with its usage and cost, whichever API you use.

Give an application its own touchpoint key​

A workspace key opens everything. When an application only needs one assistant, give it a key for a touchpoint on the API channel instead.

What is a touchpoint key?

A touchpoint key is a secret that authenticates against one touchpoint and nothing else. It opens that touchpoint's OpenAI-compatible API and its MCP server. It can't call the workspace gateway, another touchpoint, or any management API. Each touchpoint has at most one key at a time.

  1. Go to Settings → Touchpoints and open a touchpoint whose Channel is API.
  2. On the Settings tab, find the API access section. It shows the Base URL of the touchpoint, with a copy button, and the API key field.
  3. Select Generate key.
  4. Copy the key from the Generate new secret key dialog and select Done. As with workspace keys, it is shown only once; afterwards the field shows a masked value such as sk-a...9f3c.
  5. Under Use via API, pick Chat Completions or Responses, then the cURL, Python or TypeScript tab, and copy the snippet. It already points at the touchpoint's base URL and its default model, and reads the key from RATIONAL_AI_API_KEY.

The key can be sent as Authorization: Bearer <key> or in an X-API-KEY header.

The application talks to your assistant, not to a bare model

Requests through a touchpoint use its system prompt and its enabled tools, so the application gets the same assistant your users get in chat. Tools that need a person's approval and skills are left out.

Rotate or revoke a touchpoint key​

ActionWhen to use itWhat happens
RotateThe key may have leaked, or you rotate secrets on a scheduleA new key is generated and shown once. The old key stops working immediately, with no overlap.
RevokeNo application should use this touchpoint any moreThe key is deleted. Until you generate a new one, only operators can call the touchpoint's API.

Both ask for confirmation (Rotate API key, Revoke API key) and can't be undone. Rotating or revoking needs permission to edit the touchpoint.

Without a key the API is operator-only

A touchpoint with no key shows "No key yet. Only operators can call this API." Operators are administrators and holders of a workspace key from Settings → API Keys; they can call every touchpoint's API, with or without a touchpoint key.

Use a touchpoint's tools from an MCP client​

The same touchpoint is also served as an MCP server, so any client that speaks the Model Context Protocol (an IDE assistant, a desktop AI app, another agent) can use the tools you configured on it.

  • URL: the touchpoint's Base URL with /openai at the end replaced by /mcp.
  • Transport: Streamable HTTP, stateless.
  • Authentication: the touchpoint key (or operator credentials), exactly as for the touchpoint's OpenAI API.
  • What it offers: the touchpoint's enabled tools, and nothing else (no skills, prompts or resources).
Approval moves to the MCP client

The MCP server lists tools that need approval under the touchpoint's confirmation policy, marked as requiring approval. The MCP client is responsible for asking its user, so connect only clients you trust.

A touchpoint that AI application governance blocks, or rates as an unacceptable risk, refuses MCP calls.

Ask a Decision model through the System One compatible API​

Decision models return a choice, a score or a yes/no answer instead of prose. Call them with a workspace key; touchpoint keys don't work. The Use via API snippets on a Decision model in the AI Model Registry are ready to use.

Next steps​