Skip to content
  • There are no suggestions because the search field is empty.

Phin Distributor API Documentation

This is documentation for the Distributor level capabilities of the Phin public API.

Authentication

Utilizes the same Bearer token strategy as the rest of our public API. You can learn how to get a token from our authentication endpoint here! 

Routes

Name Method Domain Route
Get access token  POST  https://phin.us.auth0.com  /oauth/token
Test GET https://api.phinsec.io /distributors/:distributorId/test
Get Usage Stats GET https://api.phinsec.io

/distributors/:distributorId
/billing/usage

Create Partner POST https://api.phinsec.io /distributors/:distributorId/partner
Delete Partner DELETE https://api.phinsec.io /distributors/:distributorId/partner/:partnerId

Test

The purpose of this route is to test that you can successfully get an access token and have the correct distributor Id.

Response Reference:

Field Type Example
message string “Successfully Tested the Phin API”

Response Sample:

{ 
"message": "Successfully Tested the Phin API"
}

Error Reference:

There are no specific errors for this route. See API Reference for generic errors.

Get Usage Stats

Fetch usage statistics if they exist for this distributor

Response Reference:

Field Type Description
lastMonthEnrolledUsers number Number of users enrolled last month
totalEnrolledUsers number Number of total enrolled users overall
changeFromLastMonth number The change between current usage and last month’s usage
currentBillableUsers number Total users currently eligible for billing this month
currentBillableMonth number The current month this billing data is from
currentBillableYear number The current year this billing data is from

Response Sample:

{ "lastMonthEnrolledUsers": 316,"lastMonthBillableUsers": 183, "totalEnrolledUsers": 349, "changeFromLastMonth": 33, "currentBillableUsers": 319,"currentBillableMonth": 4,
"currentBillableYear": 2024 }

Error Reference:

Code Message Description
400 Varies Signifies that either parameters were missing or were improperly formatted. See specific error message for more information.
500 Internal server error Something went wrong with the request. Check your params and double check the admins are valid and do not exist elsewhere in Phin.

Create Partner

Create a new partner and the starting internal company under the specified distributor.

Body Reference:

Field Type Description
partner string The new partner name
admins Array<Object> List of admins to create in the partner

Body Sample:

{ "partner": "API Generated Partner","admins": [{"first": "John", "last": "Doe", "email": "johndoe@partnerdomain.com"}]}

Response Reference:

Field Type Description
partnerId string The new partner ID in Phin

Error Reference:

Code Message Description
400 Varies Signifies that either parameters were missing or were improperly formatted. See specific error message for more information.
500 Internal server error Something went wrong with the request. Check your params and double check the admins are valid and do not exist elsewhere in Phin.

Delete Partner

Delete an existing partner and their underlying companies. Note it can sometimes take a few minutes for a partner and their underlying partners to completely be removed from the portal.

Use caution when using this route. It cannot be undone!

Body Reference:

No body required.

Response Reference:

Returns a status 200 if successful.

Error Reference:

Code Message Description
404 Partner with that ID does not exist Could not find the partner with that ID. Check to make sure the ID is correct.
500 Internal server error Something went wrong with the request. Double check the partnerId exists and hasn’t been recently deleted. Otherwise reach out to Phin Support.