Reolink Authentication API

Login, logout, and session token management

Documentation

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

reolink-authentication-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Reolink Camera HTTP AI Authentication API
  description: The Reolink Camera HTTP API provides a RESTful interface for controlling and configuring Reolink IP cameras and NVRs. All commands are sent as HTTP POST requests to the /cgi-bin/api.cgi endpoint with JSON payloads. The API supports authentication via token-based sessions, device information retrieval, network configuration, video and image settings, encoding parameters, recording management, PTZ (pan-tilt-zoom) control, alarm and motion detection configuration, IR and LED light control, AI-powered object detection, and live streaming URL generation. Authentication is performed by first calling the Login command to obtain a session token, which is then passed as a query parameter on subsequent requests.
  version: '8.0'
  contact:
    name: Reolink
    url: https://reolink.com
  license:
    name: Proprietary
    url: https://reolink.com
servers:
- url: https://{camera_ip}
  description: Reolink Camera or NVR
  variables:
    camera_ip:
      default: 192.168.1.100
      description: IP address of the Reolink camera or NVR
security:
- tokenAuth: []
tags:
- name: Authentication
  description: Login, logout, and session token management
paths:
  /cgi-bin/api.cgi:
    post:
      operationId: login
      summary: Authenticate and obtain session token
      description: Authenticates a user with the camera and returns a session token for use in subsequent API requests.
      tags:
      - Authentication
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/LoginRequest'
      responses:
        '200':
          description: Successful authentication
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/LoginResponse'
  /cgi-bin/api.cgi?cmd=Logout&token={token}:
    post:
      operationId: logout
      summary: End session and invalidate token
      description: Logs out the current session and invalidates the authentication token.
      tags:
      - Authentication
      parameters:
      - $ref: '#/components/parameters/Token'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CommandRequest'
      responses:
        '200':
          description: Successful logout
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommandResponse'
components:
  parameters:
    Token:
      name: token
      in: path
      required: true
      description: Authentication token obtained from the Login command
      schema:
        type: string
  schemas:
    CommandResponse:
      type: object
      properties:
        cmd:
          type: string
          description: The command that was executed
        code:
          type: integer
          description: Response code (0 for success)
        value:
          type: object
          description: Command-specific response data
        error:
          type: object
          properties:
            rspCode:
              type: integer
              description: Error response code
            detail:
              type: string
              description: Error detail message
    LoginResponse:
      type: object
      properties:
        cmd:
          type: string
        code:
          type: integer
        value:
          type: object
          properties:
            Token:
              type: object
              properties:
                leaseTime:
                  type: integer
                  description: Token validity duration in seconds
                name:
                  type: string
                  description: Authentication token string
    LoginRequest:
      type: object
      required:
      - cmd
      - action
      - param
      properties:
        cmd:
          type: string
          enum:
          - Login
        action:
          type: integer
          enum:
          - 0
        param:
          type: object
          required:
          - User
          properties:
            User:
              type: object
              required:
              - userName
              - password
              properties:
                userName:
                  type: string
                  description: Username for authentication
                password:
                  type: string
                  description: Password for authentication
    CommandRequest:
      type: object
      required:
      - cmd
      - action
      properties:
        cmd:
          type: string
          description: The API command name
        action:
          type: integer
          description: Action type (0 for get, 1 for set)
        param:
          type: object
          description: Command-specific parameters
  securitySchemes:
    tokenAuth:
      type: apiKey
      in: query
      name: token
      description: Authentication token obtained from the Login command. Pass as a query parameter on all requests after authentication.