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

# Get the token

> Its kind, scopes and reach, and when it runs out. Any token may ask.



## OpenAPI

````yaml api-reference/v4/v4.openapi.json GET /token
openapi: 3.1.0
info:
  title: Plugchoice API
  description: >-
    Every request sends an access token as `Authorization: Bearer …`, unless an
    operation says otherwise.


    Errors are problems (RFC 9457, `application/problem+json`): `code` says what
    went wrong, and a failed validation lists the fields in `errors`.


    A list answers one page: `{"data": [...], "next_cursor": ...,
    "previous_cursor": ...}`. Pass a cursor back as `cursor` to get that page,
    and `limit` (1 to 100, default 25) for its size.


    Within v4, changes only add: new operations, new optional parameters, new
    fields and new enum values. Ignore fields you do not know, and accept enum
    values you do not know. Requests that send a field the operation does not
    know are refused, so a typo does not pass unnoticed.
  version: '4'
servers:
  - url: https://api.plugchoice.com/v4
security:
  - bearer: []
paths:
  /token:
    get:
      tags:
        - tokens
      summary: The token you call with
      description: Its kind, scopes and reach, and when it runs out. Any token may ask.
      operationId: show_token
      responses:
        '200':
          description: The token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenInfo'
        default:
          description: >-
            A problem (RFC 9457). `code` says which; the field errors come with
            `validation-failed`.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
      security:
        - bearer: []
components:
  schemas:
    TokenInfo:
      type: object
      description: The token a request was made with.
      required:
        - kind
        - client_id
        - scopes
        - expires_at
      properties:
        client_id:
          type: string
          description: The client the token was issued to.
        ends_at:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            When a personal API token stops working; null when it has no end,
            and for other tokens.
        expires_at:
          type: string
          format: date-time
          description: When this access token runs out; get a new one before then.
        kind:
          $ref: '#/components/schemas/TokenKind'
        reach:
          oneOf:
            - $ref: '#/components/schemas/TokenReach'
              description: >-
                The teams and locations it works for; null for the person's
                whole account.
            - type: 'null'
        scopes:
          type: array
          items:
            $ref: '#/components/schemas/Scope'
          description: >-
            The scopes it holds. A scope never gives more than the person's own
            access.
        user_id:
          type:
            - string
            - 'null'
          format: uuid
          description: The person the token acts for; null for a client's own token.
    Problem:
      type: object
      description: An error response body (RFC 9457).
      required:
        - type
        - title
        - status
        - code
      properties:
        code:
          type: string
          description: 'The kind of problem, for code to act on: the last part of `type`.'
        detail:
          type: string
          description: >-
            What went wrong with this request, when there is more to say than
            the title.
        errors:
          type: array
          items:
            $ref: '#/components/schemas/FieldError'
          description: 'With `validation-failed`: the fields that broke a rule.'
        status:
          type: integer
          format: int32
          description: The HTTP status code.
          minimum: 0
        title:
          type: string
          description: A short summary of the kind of problem.
        type:
          type: string
          description: The page that explains this kind of problem.
    TokenKind:
      type: string
      description: What made the token.
      enum:
        - personal
        - user
        - client
    TokenReach:
      type: object
      description: The teams and locations a token is limited to.
      required:
        - teams
        - locations
      properties:
        locations:
          type: array
          items:
            type: string
            format: uuid
        teams:
          type: array
          items:
            type: string
            format: uuid
    Scope:
      type: string
      description: 'A scope: what a token may be used for, as `resource:action`.'
      enum:
        - chargers:read
        - chargers:control
        - chargers:write
        - transactions:read
        - transactions:write
        - locations:read
        - locations:write
        - meters:read
        - teams:read
        - teams:write
        - webhooks:read
        - webhooks:write
        - billing:read
        - billing:write
    FieldError:
      type: object
      description: One field that broke a rule.
      required:
        - field
        - code
        - message
      properties:
        code:
          type: string
          description: >-
            The rule it broke, for code to act on: `missing-field`,
            `unknown-field`, `invalid-type`,

            `invalid`, or `taken` (a value that must be unique, such as a card's
            id at a location,

            and is not).
        field:
          type: string
          description: >-
            Where the field is in the request, such as `name` or
            `connectors[0].max_current`.
        message:
          type: string
          description: What is wrong, in English.
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        An access token from `accounts.plugchoice.com`, for a personal API
        token, a person signed in through an app, or an OAuth client.

````

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