---
title: "Get token"
url: "https://developer-beta.morningstar.com/apis/time-series-api/versions/64e349d6-6f88-44cb-8d05-c86bc4a80b3b/operations/createToken"
---

> Full API specification: https://developer-beta.morningstar.com/apis/time-series-api/versions/64e349d6-6f88-44cb-8d05-c86bc4a80b3b.md

# Get token

`POST` `/token/oauth`

Operation ID: `createToken`

Exchanges your Client ID and Client Secret for a signed JWT bearer token. Send your credentials as a Base64-encoded `clientId:clientSecret` string in the `Authorization` header. Use the returned `access_token` as a `Bearer` token on all other endpoints in this API.

## Responses

- `200` - 200: OK
- `401` - 401: Unauthorized

## OpenAPI definition

```yaml
openapi: 3.1.0
info:
  title: Time Series API
  version: "1.0"
servers:
  - url: https://www.us-api.morningstar.com
    description: Americas
  - url: https://www.apac-api.morningstar.com
    description: APAC
  - url: https://www.emea-api.morningstar.com
    description: EMEA
paths:
  /token/oauth:
    post:
      tags:
        - Authentication
      summary: Get token
      description: >-
        Exchanges your Client ID and Client Secret for a signed JWT bearer
        token.


        Send your credentials as a Base64-encoded `clientId:clientSecret` string
        in the `Authorization` header. Use the returned `access_token` as a
        `Bearer` token on all other endpoints in this API.
      operationId: createToken
      security:
        - Basic: []
      responses:
        "200":
          $ref: "#/components/responses/ResponseToken"
        "401":
          $ref: "#/components/responses/ErrorResponse401"
security:
  - Basic: []
components:
  responses:
    ResponseToken:
      description: "200: OK"
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/OutputToken"
          examples:
            ResponseTokenExample1:
              $ref: "#/components/examples/ResponseTokenExample1"
    ErrorResponse401:
      description: "401: Unauthorized"
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponseAuthentication"
          examples:
            ErrorResponseExample1:
              $ref: "#/components/examples/ErrorResponseExample1"
  schemas:
    OutputToken:
      type: object
      description: A successful authentication response containing a JWT bearer token.
      required:
        - access_token
        - expires_in
        - token_type
      properties:
        access_token:
          type: string
          description: The signed JWT to use as a `Bearer` token in subsequent
            authenticated requests.
          examples:
            - eyJhbGciOiJ example
        expires_in:
          type: integer
          description: The number of seconds until the token expires. After expiry,
            request a new token.
          examples:
            - 3599
        token_type:
          type: string
          description: The token type. Always `Bearer`.
          examples:
            - Bearer
    ErrorResponseAuthentication:
      title: ErrorResponseAuthentication
      type: object
      description: A response body returned when authentication fails.
      required:
        - error_message
      additionalProperties: false
      properties:
        error_message:
          type: string
          description: A human-readable description of the error.
          examples:
            - Incorrect username or password
  examples:
    ResponseTokenExample1:
      summary: Output Authorization Token
      value:
        access_token: W9ybmluZ3N0YXIuY29tL2VtYWlsX3ZlcmlmaWVkIjpmYWxzZSwiaHR0cHM6Ly9tb3JuaW5nc3Rhci5jb20vcGFzc3dvcmRDaGFuZ2VSZXF1aXJlZCI6ZmFsc2UsImh0dHBzOi8vbW9ybmluZ3N0YXIuY29tL3VpbV9yb2xlcyI6IkVBTVMsSU5WRVNUTUVOVEFQSV9JTlRFUk5BTF9TRVJWSUNFX0FDQ09VTlQiLCJpc3MiOiJodHRwczovL2xvZ2luLXByb2QubW9ybmluZ3N0YXIuY29tLyIsInN1YiI6ImF1dGgwfEZFMTUzOEM4LTg0RDMtNDlCRC05MzNELTdGQkEyOERGODAzMyIsImF1ZCI6WyJodHRwczovL2F1dGgwLWF3c3By
        expires_in: 3599
        token_type: Bearer
    ErrorResponseExample1:
      summary: "401: Unauthorized"
      value:
        error_message: Incorrect username or password
  securitySchemes:
    Basic:
      type: http
      scheme: basic
      description: >-
        Used only by `POST /token/oauth` to obtain a bearer token.


        Send your Client ID and Client Secret as a Base64-encoded
        `clientId:clientSecret` pair.
```
