Skip to content

Refresh token​

POST
/users/refreshToken

Refresh the access token and refresh token that was retrieved during login.

Request Body​

application/json
JSON
{
  
"accessToken": "string",
  
"refreshToken": "string",
  
"refreshable": 0
}

Request example

Responses​

OK

application/json
JSON
{
  
"expiry": "string",
  
"refreshToken": "string",
  
"refreshTokenExpiry": "string",
  
"token": "string",
  
"userId": 0
}
Try this endpoint

Playground​

Body

OpenAPI definition ​

References are expanded below, except recursive definitions and references with sibling fields. Documentation overrides are included. Full original OpenAPI spec (JSON).

View endpoint OpenAPI definition
yaml
info:
  title: Lightbug API
  version: '2'
externalDocs:
  description: ''
  url: ''
openapi: 3.1.0
servers:
  - url: https://api.lightbug.cloud/v2
tags: []
paths:
  /users/refreshToken:
    post:
      description: Refresh the access token and refresh token that was retrieved during login.
requestBody:
yaml
        content:
          application/json:
            schema:
              properties:
                accessToken:
                  description: Current access token (may be expired)
                  type: string
                refreshToken:
                  description: Current refresh token
                  type: string
                refreshable:
                  description: A new refresh token will be generated, with an expiry this many seconds after the access token expiry. Max 31 days
                  maximum: 2678400
                  type: integer
              required:
                - accessToken
                - refreshToken
                - refreshable
              type: object
        description: RefreshToken
        required: true
yaml
      responses:
'200':
yaml
          content:
            application/json:
              schema:
                properties:
                  expiry:
                    description: Expiry of the access token
                    type: string
                  refreshToken:
                    description: Single use refresh token
                    type: string
                  refreshTokenExpiry:
                    description: Expiry of the refresh token
                    type: string
                  token:
                    description: JWT access token
                    type: string
                  userId:
                    description: User ID of the logged in user
                    type: integer
                required:
                  - expiry
                  - refreshToken
                  - refreshTokenExpiry
                  - token
                  - userId
                type: object
          description: OK
'400':
yaml
          content:
            application/json:
              schema:
                properties:
                  code:
                    example: 400
                    type: integer
                  message:
                    example: status bad request
                    type: string
                type: object
          description: Bad Request
'401':
yaml
          content:
            application/json:
              schema:
                properties:
                  code:
                    example: 400
                    type: integer
                  message:
                    example: status bad request
                    type: string
                type: object
          description: Unauthorized
'429':
yaml
          content:
            application/json:
              schema:
                type: string
          description: Limit exceeded
          headers:
            X-Ratelimit-Limit:
              schema:
                type: integer
            X-Ratelimit-Remaining:
              schema:
                type: integer
            X-Ratelimit-Reset:
              schema:
                type: integer
'500':
yaml
          content:
            application/json:
              schema:
                properties:
                  code:
                    example: 400
                    type: integer
                  message:
                    example: status bad request
                    type: string
                type: object
          description: Internal Server Error
yaml
      summary: Refresh token
      tags:
        - auth
      operationId: post-users-refreshToken