Reolink PTZ API

Pan-tilt-zoom control, presets, patrols, and calibration

Documentation

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

reolink-ptz-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Reolink Camera HTTP AI PTZ 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: PTZ
  description: Pan-tilt-zoom control, presets, patrols, and calibration
paths:
  /cgi-bin/api.cgi?cmd=PtzCtrl&token={token}:
    post:
      operationId: ptzCtrl
      summary: Control PTZ movement
      description: Controls pan, tilt, and zoom movements of PTZ-capable cameras. Supported operations include directional movement (Up, Down, Left, Right), zoom (ZoomInc, ZoomDec), focus (FocusInc, FocusDec), preset navigation (ToPos), and Stop.
      tags:
      - PTZ
      parameters:
      - $ref: '#/components/parameters/Token'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PtzCtrlRequest'
      responses:
        '200':
          description: PTZ command executed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommandResponse'
  /cgi-bin/api.cgi?cmd=GetPtzPreset&token={token}:
    post:
      operationId: getPtzPreset
      summary: Get PTZ presets
      description: Retrieves the list of configured PTZ preset positions.
      tags:
      - PTZ
      parameters:
      - $ref: '#/components/parameters/Token'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChannelRequest'
      responses:
        '200':
          description: PTZ presets retrieved
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommandResponse'
  /cgi-bin/api.cgi?cmd=SetPtzPreset&token={token}:
    post:
      operationId: setPtzPreset
      summary: Set PTZ preset position
      description: Saves the current PTZ position as a named preset.
      tags:
      - PTZ
      parameters:
      - $ref: '#/components/parameters/Token'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CommandRequest'
      responses:
        '200':
          description: PTZ preset saved
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommandResponse'
  /cgi-bin/api.cgi?cmd=GetPtzPatrol&token={token}:
    post:
      operationId: getPtzPatrol
      summary: Get PTZ patrol settings
      description: Retrieves PTZ patrol route configuration.
      tags:
      - PTZ
      parameters:
      - $ref: '#/components/parameters/Token'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChannelRequest'
      responses:
        '200':
          description: PTZ patrol settings retrieved
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommandResponse'
  /cgi-bin/api.cgi?cmd=SetPtzPatrol&token={token}:
    post:
      operationId: setPtzPatrol
      summary: Set PTZ patrol configuration
      description: Configures PTZ patrol routes and timing.
      tags:
      - PTZ
      parameters:
      - $ref: '#/components/parameters/Token'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CommandRequest'
      responses:
        '200':
          description: PTZ patrol settings updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommandResponse'
  /cgi-bin/api.cgi?cmd=PtzCheck&token={token}:
    post:
      operationId: ptzCheck
      summary: Calibrate PTZ
      description: Initiates PTZ calibration to reset the pan-tilt-zoom mechanism.
      tags:
      - PTZ
      parameters:
      - $ref: '#/components/parameters/Token'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChannelRequest'
      responses:
        '200':
          description: PTZ calibration started
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommandResponse'
  /cgi-bin/api.cgi?cmd=GetPtzCheckState&token={token}:
    post:
      operationId: getPtzCheckState
      summary: Get PTZ calibration status
      description: Retrieves the current state of PTZ calibration.
      tags:
      - PTZ
      parameters:
      - $ref: '#/components/parameters/Token'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChannelRequest'
      responses:
        '200':
          description: PTZ calibration state retrieved
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommandResponse'
  /cgi-bin/api.cgi?cmd=GetAutoTrack&token={token}:
    post:
      operationId: getAutoTrack
      summary: Get auto-tracking settings
      description: Retrieves AI auto-tracking configuration for PTZ cameras.
      tags:
      - PTZ
      parameters:
      - $ref: '#/components/parameters/Token'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChannelRequest'
      responses:
        '200':
          description: Auto-tracking settings retrieved
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommandResponse'
  /cgi-bin/api.cgi?cmd=SetAutoTrack&token={token}:
    post:
      operationId: setAutoTrack
      summary: Set auto-tracking settings
      description: Configures AI auto-tracking behavior for PTZ cameras.
      tags:
      - PTZ
      parameters:
      - $ref: '#/components/parameters/Token'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CommandRequest'
      responses:
        '200':
          description: Auto-tracking settings updated
          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
    ChannelRequest:
      type: object
      required:
      - cmd
      - action
      - param
      properties:
        cmd:
          type: string
          description: The API command name
        action:
          type: integer
          description: Action type (0 for get)
        param:
          type: object
          required:
          - channel
          properties:
            channel:
              type: integer
              description: Camera channel number (starting from 0)
    PtzCtrlRequest:
      type: object
      required:
      - cmd
      - action
      - param
      properties:
        cmd:
          type: string
          enum:
          - PtzCtrl
        action:
          type: integer
          enum:
          - 0
        param:
          type: object
          required:
          - channel
          - op
          properties:
            channel:
              type: integer
              description: Camera channel number
            op:
              type: string
              description: PTZ operation to perform
              enum:
              - Stop
              - Left
              - Right
              - Up
              - Down
              - LeftUp
              - LeftDown
              - RightUp
              - RightDown
              - ZoomInc
              - ZoomDec
              - FocusInc
              - FocusDec
              - ToPos
              - Auto
            speed:
              type: integer
              description: Movement speed (1-64)
              minimum: 1
              maximum: 64
            id:
              type: integer
              description: Preset ID for ToPos operation
    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.