Accept: application/json header so the server returns machine-readable responses. Both headers are required for all authenticated endpoints.
Required Headers
Include the following two headers in every API request:Admin vs. Student Tokens
VClasses uses role-based access control. The role is attached to your account at the time your token is issued — you do not need to specify it in the request itself.- Admin tokens grant access to all admin-scoped endpoints, such as managing homeworks, grades, and course settings.
- Student tokens are required for student-scoped actions, such as submitting quiz answers and viewing personal results.
Authorization: Bearer <your-token> header format. If you send a request to an endpoint that requires a different role than the one attached to your token, the API returns a 403 Forbidden error (see Authentication Errors below).
If you need to act in both an admin and a student capacity, use the token that corresponds to the role required by each specific endpoint.
Example: Authenticated Request
The following example retrieves the list of homeworks from an admin endpoint. Replaceyour-token-here with your actual token:
Authentication Errors
When authentication fails, the API returns one of the following HTTP error codes:
If you receive a
401, verify that your token is correct and has not expired, and confirm that the Authorization header is present and formatted as Bearer <your-token>. If you receive a 403, confirm that you are using a token whose role matches the requirements of the endpoint you are calling.

