Creates a Link token that you’ll use to initialize the Link flow in your frontend application.
Request Body Parameters
Required Parameters
user_id (string) - A unique identifier for the end user from your system. Do not use PII like email or phone.
org_id (string) - A unique identifier for the organization from your system (e.g., clinic or hospital ID).
Optional Parameters (for creating new organizations)
If the org_id doesn’t exist yet, provide these parameters to create the organization:
emr_name (string) - The EMR system name. Contact support for a list of supported EMR systems.
emr_instance_domain (string) - The EMR instance URL (e.g., https://your-emr-instance.com)
Other Optional Parameters
access_token (string) - Include to use update mode for an existing connection
Example Request (Existing Organization)
curl -X POST https://api.usecobalt.com/link/token/create \
-H 'Content-Type: application/json' \
-H 'client_id: ci_live_198908HJDKJSH98789OHKJL' \
-H 'client_secret: cs_live_9827hofdsklOYYHJLJh' \
-d '{
"user_id": "user_12345",
"org_id": "org_67890"
}'
Example Request (New Organization)
curl -X POST https://api.usecobalt.com/link/token/create \
-H 'Content-Type: application/json' \
-H 'client_id: ci_live_198908HJDKJSH98789OHKJL' \
-H 'client_secret: cs_live_9827hofdsklOYYHJLJh' \
-d '{
"user_id": "user_12345",
"org_id": "org_67890",
"emr_name": "YourEMRName",
"emr_instance_domain": "https://your-emr-instance.com"
}'
Example Response
{
"success": true,
"token": "lt_198908HJDKJSH98789OHKJL"
}
Update Mode
To use update mode for an existing connection, include the access_token in your request:
curl -X POST https://api.usecobalt.com/link/token/create \
-H 'Content-Type: application/json' \
-H 'client_id: ci_live_198908HJDKJSH98789OHKJL' \
-H 'client_secret: cs_live_9827hofdsklOYYHJLJh' \
-d '{
"user_id": "user_12345",
"org_id": "org_67890",
"access_token": "493JKLHIU98789hLKH9HHJH"
}'
The Link token is single-use and expires after 30 minutes.