Skip to main content
Use your application API key to obtain a Partner JWT after the clinician connects their Cortexa account. Use that JWT for clinical API requests.

Before you begin

Ask your Cortexa integration contact for an application ID, API key, Cortexa app URL, and registered HTTPS callback. Keep the API key on your backend. The examples use the sandbox API:

1. Connect the clinician

Open /scribe/authorize on your assigned Cortexa app URL, with these query parameters. Your application supplies the values automatically. Example path using synthetic values:
Prepend your assigned Cortexa app URL. The clinician signs in, selects a workspace, and allows access. Cortexa then redirects to your callback with code and state. Verify state and exchange the code within 60 seconds. Each code works once.
external_user_id comes from your system; the clinician does not enter it. If it is missing or empty, the authorization page shows an incomplete-link error and cannot continue. A direct authorization request returns 422.

2. Exchange the code

POST /jwt — call this from your backend with the Cortexa-Api-Key header. Load CORTEXA_API_KEY from your secret store and CORTEXA_AUTHORIZATION_CODE from the verified callback.
Example response:
Save the grant ID with the clinician’s record in your system. You only send external_user_id during authorization; later requests use the code, grant ID, or JWT as shown here.

3. Call the API

Send the Partner JWT in the Authorization header:
This returns the authorized workspace. Use the same grant throughout a consultation: patients and sessions are accessible only through their own grant.

4. Renew the token

Set CORTEXA_GRANT_ID to the saved grant ID. Before the JWT expires, send the grant ID and your API key to obtain another token:
Send exactly one of authorization_code or grant_id. The clinician does not need to sign in again while the grant remains valid. This flow uses the saved grant ID rather than a refresh token. If access is revoked or the clinician loses workspace access, reconnect the clinician. Key rotation or application disablement can also invalidate tokens.

Scopes

Request scopes enabled for your application. Workspace permissions, template access, entitlements, and quotas also apply. Coding and E/M GET requests require scribe:generate because they can start processing.

Which credential should I use?

A clinician’s normal Cortexa login token cannot replace the Partner JWT.
JWTs use RS256. Public keys are available at GET /.well-known/jwks.json without authentication. Match kid, enforce RS256, and verify the issuer, audience, and expiry for your environment. Cortexa also checks current access on each request.

Troubleshooting

Continue with your first note.