Authorisation URL
This is where you’ll send your users to begin the authorisation process. This is not an API endpoint.Example
A detailed view of the auth url
Example
A detailed view of the auth url
Query parameters
| Parameter | Explanation |
|---|---|
response_type | Always the string code. This is part of the OAuth 2 specification and code is currently the only value we support. |
client_id | The client ID we gave you when you registered. Do not include your secret in this link, as it will be exposed to the public. |
redirect_uri | This is a link to your app or service, where users will be sent when they successfully log in and authorise your app. It must be registered with us. Ensure that this is encoded as a URI component, to avoid any issues with special characters. |
country | uk for the United Kingdom and an ISO 3166 two-letter country code otherwise. The countries available to you depend on your plan with us. |
Success
Successfully authenticated and verified users who authorise your application will be redirected to your app in their browser, at the redirect URI you provide to us. If you have registered more than one redirect URI, we will use the one you included in the URL above. When a user has authorised your app, we will give you an authorisation grant code in thecode query parameter on the redirect URI.
A user who chooses not to authorise your app by clicking “Cancel” will be sent back to the redirect URI you provided without the authorisation grant code. This is not an error, and doesn’t have any relation to their verification status.
Below are some examples of redirect URIs you might send to us, and where we will send the user as a result.
- Default (HTTPS)
- Alternative Scheme
- Custom Query Parameters
Errors
These are shown on our service but it may be helpful to know their causes in case users report them to you. They are typically caused by an issue with your implementation, but contact your account manager or support if you continue to have issues.The redirect uri included is not valid
Redirect URIs must be registered with us and are matched strictly on scheme, authority and path. Check that theredirect_uri parameter you are including is correct.
Client authentication failed due to unknown client, no client authentication included, or unsupported authentication method
Ensure that theclient_id parameter you are including is correct.
The authorization server does not support this response type
Theresponse_type parameter must be code.
API Endpoints
These endpoints are accessed athttps://accounts.studentbeans.com - note the subdomain, which is different from the authorisation URL above.
POST /oauth/token
Exchange an authorisation grant code for an API access token.
Example
Example
| Parameter | Explanation |
|---|---|
grant_type | Always the string authorization_code. This is part of the OAuth 2 specification, and the only value we support. |
code | The authorisation grant code we included in the redirect URI when we sent the user back to you in the previous step. |
redirect_uri | This must be the same as the redirect URI you sent in the login link earlier, including any additional query parameters. |
client_id | The client ID we gave you when you registered. |
client_secret | The client secret we gave you when you registered. |
Success
On success, you will receive a JSON object containing an access token, refresh token and metadata.Error
In the case of an error, we will return an appropriate HTTP status code and a JSON-formatted body detailing the problem.400 Bad Request
invalid_grant
code) you’ve sent us is invalid, has been used already or has expired. If you have different client IDs across several clients, the code may have been generated for a different client ID.
Ensure that the redirect URI exactly matches the one you included in the redirect_uri parameter when you linked the user to /oauth/authorize. It must match exactly, including any custom query parameters this time.
invalid_request
code parameter, ensure that users who arrive at your redirect URI without the code parameter are handled correctly - this can happen when they decline to authorise your app.
unsupported_grant_type
grant_type query parameter in your request is present and has the value authorization_code. We do not currently support other grant types.
401 Unauthorized
GET /api/v3/me.json
Get an authorised user’s verification information.
Example
Example
- Query Parameter
Success
- Verified (one supergroup)
- Verified (several supergroups)
- Not Verified
The user has an active verification in one group.
Response field reference
| Key | Possible values | Description |
|---|---|---|
sbid_number | 7-character alphanumeric string | A unique identifier for a Student Beans or Beans ID user account. Having an SBID number does not mean that a user is verified with any consumer group. |
verifications | Array of JSON objects | This will always be an array but may be empty if a user has no active verifications. |
supergroup | String representing a supergroup | This will be one of the consumer supergroups we verify. For data protection, we currently don’t list the specific closed consumer groups that a user is part of, except for students and graduates. You can find a list of the supergroups we may return below. |
expires_on | String representing a date | Formatted as a date (YYYY-MM-DD), this is the day on which the relevant verification expires - that is, the first day that the verification will no longer be valid. |
Error
In case of error, our response will include an appropriate HTTP status code.400 Bad Request
This response has no body. It occurs when your request to us is malformed. Check that your HTTP client is configured correctly and is sending required HTTP request headers, likeHost.
401 Unauthorized
This response may have a body:Authorization header or the access_token query parameter, and that the access token is one you got from the /oauth/token API endpoint above. You cannot use the authorisation grant code for this endpoint.
403 Forbidden
This response has no body. This error may occur if your request has noUser-Agent header.
404 Not Found
This response may have a body:Consumer Supergroups reference
Below is a reference of consumer supergroups and the closed consumer groups they contain, with the string value that will appear in thesupergroup key in the API response.
| API value | Supergroup | CCGs | Theme |
|---|---|---|---|
student | Students | Just students | Young adults at a key transitional life stage, forming lifelong brand loyalties. We verify students in post-16 and higher education. |
graduate | Graduates | Just graduates | Recently graduated students — up to 5 years after graduation. |
key-worker | Key Worker | - Military and veterans - Healthcare workers - First responders - Teachers - Charity workers | Individuals dedicated to community and public welfare; the backbone of the nation’s workforce. |
social-assistance | Social Assistance | - Low-income - Disabled people - New parents | Individuals and families who qualify for support based on specific life circumstances or needs. |