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

# Get Realtime Positions

> This endpoint returns the most recent Position of each Device. You can optionally pass in filter_parameters to
filter the devices you will receive.



## OpenAPI

````yaml openapi_2024-03-26 post /realtime/device
openapi: 3.1.0
info:
  title: FastAPI
  version: '2024-03-26'
servers:
  - url: https://api.pathstack.io
    description: PathStack production environment
security: []
paths:
  /realtime/device:
    post:
      tags:
        - Real-time
      summary: Get Realtime Positions
      description: >-
        This endpoint returns the most recent Position of each Device. You can
        optionally pass in filter_parameters to

        filter the devices you will receive.
      operationId: get_realtime_positions_realtime_device_post
      parameters:
        - name: x-api-version
          in: header
          required: false
          schema:
            type: string
            format: date
            default: '2024-03-26'
            title: X-Api-Version
          examples:
            default:
              value: '2024-03-26'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RealTimeParameters'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Success_list_Union_RealtimeValidState__RealtimeTimeoutState___
        '400':
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: integer
                        example: 400
                        title: Error code
                      message:
                        type: string
                        example: Invalid JWT format
                        title: Error message
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: integer
                        example: 401
                        title: Error code
                      message:
                        type: string
                        example: >-
                          Authentication header is missing, or token is
                          invalid/expired.
                        title: Error message
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: integer
                        example: 403
                        title: Error code
                      message:
                        type: string
                        example: You do not have access to this resource
                        title: Error message
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: integer
                        example: 404
                        title: Error code
                      message:
                        type: string
                        example: Unknown device_ids <string>, ...
                        title: Error message
          description: Not Found
        '422':
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: integer
                        example: 422
                        title: Error code
                      message:
                        type: string
                        example: Field required
                        title: Error message
                      loc:
                        items:
                          anyOf:
                            - type: string
                            - type: integer
                        type: array
                        title: Location
                      msg:
                        type: string
                        title: Message
                      type:
                        type: string
                        title: Error Type
          description: Unprocessable Entity
      security:
        - JWTBearer: []
components:
  schemas:
    RealTimeParameters:
      properties:
        filters:
          anyOf:
            - $ref: '#/components/schemas/RealTimeFilter'
            - type: 'null'
        options:
          anyOf:
            - $ref: '#/components/schemas/RealTimeOption'
            - type: 'null'
      additionalProperties: false
      type: object
      title: RealTimeParameters
    Success_list_Union_RealtimeValidState__RealtimeTimeoutState___:
      properties:
        data:
          items:
            anyOf:
              - $ref: '#/components/schemas/RealtimeValidState'
              - $ref: '#/components/schemas/RealtimeTimeoutState'
          type: array
          title: Data
          description: Successful response payload
      type: object
      required:
        - data
      title: Success[list[Union[RealtimeValidState, RealtimeTimeoutState]]]
    RealTimeFilter:
      properties:
        connection_ids:
          anyOf:
            - items:
                type: string
                format: uuid4
              type: array
            - type: 'null'
          title: Connection Ids
        tags:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Tags
        device_ids:
          anyOf:
            - items:
                type: string
                format: uuid4
              type: array
            - type: 'null'
          title: Device Ids
        connection_devices:
          anyOf:
            - items:
                $ref: '#/components/schemas/ConnectionDevices'
              type: array
            - type: 'null'
          title: Connection Devices
      additionalProperties: false
      type: object
      title: RealTimeFilter
    RealTimeOption:
      properties:
        include_speed:
          type: boolean
          title: Include Speed
          default: true
        include_driver_id:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Include Driver Id
      additionalProperties: false
      type: object
      title: RealTimeOption
    RealtimeValidState:
      properties:
        connection_id:
          type: string
          format: uuid4
          title: Connection Id
        device_id:
          type: string
          format: uuid4
          title: Device Id
        system_device_id:
          type: string
          title: System Device Id
        position:
          $ref: '#/components/schemas/RealtimePosition'
      type: object
      required:
        - connection_id
        - device_id
        - system_device_id
        - position
      title: RealtimeValidState
    RealtimeTimeoutState:
      properties:
        device_id:
          type: string
          format: uuid4
          title: Device Id
        status:
          type: string
          title: Status
      type: object
      required:
        - device_id
        - status
      title: RealtimeTimeoutState
    ConnectionDevices:
      properties:
        connection_id:
          type: string
          format: uuid4
          title: Connection Id
        system_device_ids:
          items:
            type: string
          type: array
          title: System Device Ids
      type: object
      required:
        - connection_id
        - system_device_ids
      title: ConnectionDevices
    RealtimePosition:
      properties:
        timestamp:
          type: string
          title: Timestamp
        longitude:
          type: number
          title: Longitude
        latitude:
          type: number
          title: Latitude
        heading:
          anyOf:
            - type: number
            - type: 'null'
          title: Heading
        speed:
          anyOf:
            - $ref: '#/components/schemas/Speed'
            - type: 'null'
        driver_id:
          anyOf:
            - $ref: '#/components/schemas/DriverId'
            - type: 'null'
      type: object
      required:
        - timestamp
        - longitude
        - latitude
      title: RealtimePosition
    Speed:
      properties:
        speed_kph:
          anyOf:
            - type: number
            - type: 'null'
          title: Speed Kph
      type: object
      title: Speed
    DriverId:
      properties:
        format:
          $ref: '#/components/schemas/DriverIdFormat'
        value:
          anyOf:
            - type: string
            - additionalProperties: true
              type: object
          title: Value
      type: object
      required:
        - format
        - value
      title: DriverId
    DriverIdFormat:
      type: string
      enum:
        - text
        - map
        - base64
      title: DriverIdFormat
  securitySchemes:
    JWTBearer:
      type: http
      scheme: bearer

````