Paragon
Search…
Users API

Introduction

The Users API allows you to query and modify the state of your Connected Users and their integrations.
The API includes REST endpoints (and matching SDK functions) for identifying what integrations your user has enabled, disconnecting integrations, and disabling workflows. The API also allows your application to associate metadata with a Connected User.

When to use the Users API

The Users API can be used for integration usage analysis or maintenance of Connected Users. For example, using the API methods, you can...
  • Automatically disconnect integrations when a user deletes or downgrades their account in your application
  • Enrich your Connected Users' profile information with email, name, and other metadata
  • Check if a user has enabled a certain integration and view account connection status

Authorization

Requests to the Users API are authorized with a Bearer-type Authorization header using a Paragon User Token:
https://api.useparagon.com/projects/<Paragon Project ID>/sdk/...
Authorization: Bearer <Paragon User Token>
In the SDK, the Users API can be called directly after calling paragon.authenticate:
// Authenticate the user
await paragon.authenticate("<Paragon Project ID>", "<Paragon User Token>");
// Call a Users API method, like setUserMetadata
paragon.setUserMetadata({ ... });

Examples

Associate Connected User with metadata

You can associate your user with metadata by including it in your existing SDK call to paragon.authenticate, as an additional parameter:
await paragon.authenticate("<Paragon Project ID>", "<Paragon User Token>", {
metadata: {
Name: user.fullName,
Email: user.email,
apiKey: user.apiKey
}
});
Alternatively, you can supply the metadata from your application after authenticating:
JavaScript SDK
REST API
paragon.setUserMetadata({
Name: "Sean V",
apiKey: "key_Y0kBVldPFInxK"
});
Request
PATCH https://api.useparagon.com/projects/<Project ID>/sdk/me
// Headers
Authorization: <Paragon User Token>
Content-Type: application/json
// Body
{ "meta": { "Email": "[email protected]", "apiKey": "key_Y0kBVldPFInxK" } }

Get Connected User info and integration state

You can access Connected User info (including any associated metadata) using paragon.getUser or with the REST API.
JavaScript SDK
REST API
paragon.getUser();
// Returns:
{
authenticated: true,
integrations: {
salesforce: {
enabled: true,
credentialStatus: "VALID", // "INVALID" if account is unreachable
providerData: {...}, // Account details for integration
providerId: "00502000..." // Account's unique ID for integration
}
},
meta: {...}, // Metadata provided by your application
userId: "12345" // User ID specified in "sub" field of Paragon User Token
}
Request
GET https://api.useparagon.com/projects/<Project ID>/sdk/me
// Headers
Authorization: Bearer <Paragon User Token>
Response
{
"authenticated": true,
"integrations": {
"salesforce": {
"enabled": true,
"credentialStatus": "VALID",
"providerData": {...},
"providerId": "00502000..."
}
},
"meta": {...},
"userId": "12345"
}

Disconnecting integrations

Integrations can be disconnected using paragon.uninstallIntegration or with the REST API.
When an integration is disconnected, workflows for that integration will stop running for the authenticated user and any saved User Settings will be cleared.
JavaScript SDK
REST API
// Use the integration name, as used in paragon.connect();
await paragon.uninstallIntegration("salesforce");
Get the ID of the integration you want to disconnect, with the /sdk/integrations endpoint:
Request
GET https://api.useparagon.com/projects/<Project ID>/sdk/integrations
// Headers
Authorization: Bearer <Paragon User Token>
Response
[
{ "id": "<Integration ID>", "type": "salesforce", ... },
{...}
]
The <Integration ID> can be used to disconnect the integration for the user:
Request
DELETE https://api.useparagon.com/projects/<Project ID>/sdk/integrations/<Integration ID>
// Headers
Authorization: Bearer <Paragon User Token>
Copy link
On this page
Introduction
When to use the Users API
Authorization
Examples
Associate Connected User with metadata
Get Connected User info and integration state
Disconnecting integrations