> ## Documentation Index
> Fetch the complete documentation index at: https://dev.schoolcues.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create an access token

> Trade a tool’s OneRoster credentials for an access token that lasts an hour. Send the client ID and secret as HTTP Basic authentication or in the form body.



## OpenAPI

````yaml /reference/oneroster.json post /oauth/token
openapi: 3.1.0
info:
  title: SchoolCues OneRoster 1.1
  version: '1'
  description: >-
    Give roster tools the school’s classes, teachers, students and enrollments.
    Generated from @schoolcues/contracts by `pnpm docs:api`; don't edit it by
    hand.
servers:
  - url: https://portal.schoolcues.com
    description: Production
security: []
tags:
  - name: Access Tokens
  - name: Collections
paths:
  /oauth/token:
    post:
      tags:
        - Access Tokens
      summary: Create an access token
      description: >-
        Trade a tool’s OneRoster credentials for an access token that lasts an
        hour. Send the client ID and secret as HTTP Basic authentication or in
        the form body.
      operationId: create_access_token
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                grant_type:
                  type: string
                  const: client_credentials
                client_id:
                  description: >-
                    The client ID, starting `sc_`, unless it is sent as HTTP
                    Basic authentication.
                  type: string
                  maxLength: 200
                client_secret:
                  description: The secret, unless it is sent as HTTP Basic authentication.
                  type: string
                  maxLength: 200
              required:
                - grant_type
      responses:
        '200':
          description: The access token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CredentialToken'
        '401':
          description: The client ID or secret is wrong, or the credentials were deleted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - basic: []
        - {}
components:
  schemas:
    CredentialToken:
      type: object
      properties:
        access_token:
          type: string
          description: The token to send as the bearer token.
        token_type:
          type: string
          const: Bearer
          description: Always `Bearer`.
        expires_in:
          type: number
          description: Seconds until it expires.
      required:
        - access_token
        - token_type
        - expires_in
    Error:
      type: object
      description: Why the request was refused.
      properties:
        statusCode:
          type: integer
          description: The HTTP status.
        statusMessage:
          type: string
          description: What went wrong, in words to show.
      required:
        - statusCode
        - statusMessage
  securitySchemes:
    basic:
      type: http
      scheme: basic
      description: The client ID and secret.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.