Workspaces, Invitations & Credits Admin
Scope
Internal support/admin runbook for logging in and managing company workspaces, invitation codes, and credits through the Supergraph (federated) GraphQL API. Several actions require a CRED admin token.
0. User Login — Get Authentication Token
Supergraph / Federated API endpoints:
| Environment | Endpoint |
|---|---|
| Dev | https://api-dev.credplatform.com/graphql |
| Staging | https://api-staging.credplatform.com/graphql |
| Prod | https://api.credplatform.com/graphql |
Before doing any operations, authenticate and get a token.
Mutation: Login
mutation Login($email: String!, $password: String!) {
login(email: $email, password: $password) {
token
}
}
Variables example
{
"email": "your-email@example.com",
"password": "yourpassword"
}
Usage
Use the returned token in the HTTP Authorization header for all following
requests:
Authorization: Bearer YOUR_TOKEN_HERE
1. Add a New Company Workspace
Create a workspace if the company is new by adding company settings. The
viewerCompanyIds array must contain the companyId.
Mutation: AddCompanySettings
mutation AddCompanySettings($input: InputAddCompanySettings!) {
addCompanySettings(input: $input) {
id
}
}
Variables example
{
"input": {
"companyId": 774416,
"viewerCompanyIds": [774416]
}
}
2. Create Support Invitation Codes / Users
Create invitation codes to invite users.
Mutation: CreateInvitation
mutation CreateInvitation($input: InputCreateInvitation!) {
createInvitation(input: $input) {
id
companyId
}
}
Variables example
{
"input": {
"companyId": 774416,
"inviteCode": "DEFYVC+support",
"defaultCurrency": "USD",
"requireSSO": false,
"role": "ADMIN"
}
}
3. Add Balance to a Company Workspace
Add credits to the company workspace.
Credits land on the workspace, not the user
Credits added through this process are only added to the company workspace. If the intention is to allocate credits to a specific user, transfer them to that user immediately after adding them to the workspace (see section 4). This ensures the credits are not used for other company purposes.
Permission
Only tokens from CRED admin users can perform this action.
Mutation: CreateDebitFeatureLog
mutation CreateDebitFeatureLog($input: InputCreateDebitFeatureLog!) {
createDebitFeatureLog(input: $input) {
userCompanyId
}
}
Variables example
{
"input": {
"featureId": 54,
"featureUnitsAmount": 5000,
"userCompanyId": 826787
}
}
4. Transfer Credits to a User
Transfer credits from the company workspace to a specific user.
Prefer the app
Using this mutation is only recommended when there is no support admin user available for the company. Otherwise, perform this action through the app.
Permission
Only tokens from CRED admin users or the company admin users can execute this.
Mutation: TransferCredits
mutation TransferCredits($input: InputTransferCredits!) {
transferCredits(input: $input)
}
Variables example
{
"input": {
"amount": 5000,
"toUserIds": [619],
"userCompanyId": 826787
}
}
toUserIds is User.id, not personId
toUserIds takes the User.id from the User table — not the
personId.
If you do not know the User.id, look it up in the database.
Search by email
SELECT *
FROM "User"
WHERE email = 'thepersonemail@example.com';
Search by first name and company
If you do not know the email, search by first name and company:
SELECT *
FROM "User"
WHERE "firstName" = 'Name'
AND "userCompanyId" = 282828; -- replace with the actual companyId
The first column named id contains the user ID (User.id).
Summary of Token Permissions
| Action | Token Required |
|---|---|
| Login | None (initial authentication) |
| Add Company Workspace | Any valid token |
| Create Invitation Codes | Any valid token |
| Add Credits | CRED Admin user token only |
| Transfer Credits | CRED Admin or Company Admin user tokens |
Activating filters
To activate filters, visit the filters page in accounts to initialize them.