Skip to content

Gets a single geofence​

GET
/users/{userid}/geofences/{fenceid}

Authorizations​

ApiKeyAuth

API Key for authentication. Retrieval from either API version login routes, or other authentication token type. See Authentication for more details.

Type
API Key (header: Authorization)
Example"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Parameters​

Path Parameters

userid*

User ID

Type
integer
Required
fenceid*

Geofence ID

Type
integer
Required

Query Parameters

_include

Include related models

Type
string
Valid values
"list"

Request example

Responses​

OK

application/json
JSON
{
  
"center": {
  
  
"lat": 0,
  
  
"lng": 0
  
},
  
"deviceId": 0,
  
"foreignId": "string",
  
"id": 0,
  
"list": {
  
  
"color": "string",
  
  
"id": 0,
  
  
"name": "string",
  
  
"ownerId": 0
  
},
  
"listId": 0,
  
"meta": {
  
  
"additionalProperties": null
  
},
  
"modified": true,
  
"name": "string",
  
"outline": [
  
  
{
  
  
  
"lat": 0,
  
  
  
"lng": 0
  
  
}
  
],
  
"ownerId": 0,
  
"radius": 0,
  
"type": "string"
}
Try this endpoint

Playground​

Authorization
Variables
Key
Value

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
security:
  - ApiKeyAuth: []
tags: []
paths:
  /users/{userid}/geofences/{fenceid}:
    get:
      parameters:
        - description: User ID
          in: path
          name: userid
          required: true
          schema:
            type: integer
        - description: Geofence ID
          in: path
          name: fenceid
          required: true
          schema:
            type: integer
        - description: Include related models
          in: query
          name: _include
          schema:
            enum:
              - list
            type: string
      responses:
'200':
yaml
          content:
            application/json:
              schema:
                properties:
                  center:
                    description: For circular geofences, the center {lat:x,lng:y}. Property is ignored if outline != null.
                    properties:
                      lat:
                        type: number
                      lng:
                        type: number
                    type: object
                  deviceId:
                    type: integer
                  foreignId:
                    type: string
                  id:
                    type: integer
                  list:
                    properties:
                      color:
                        type: string
                      id:
                        type: integer
                      name:
                        type: string
                      ownerId:
                        type: integer
                    required:
                      - color
                      - name
                    type: object
                  listId:
                    type: integer
                  meta:
                    additionalProperties: {}
                    type: object
                  modified:
                    type: boolean
                  name:
                    type: string
                  outline:
                    description: |-
                      List of {lat:x,lng:y} objects representing the vertices of the polygon.
                      Not to be used with center and radius.
                    items:
                      description: For circular geofences, the center {lat:x,lng:y}. Property is ignored if outline != null.
                      properties:
                        lat:
                          type: number
                        lng:
                          type: number
                      type: object
                    type: array
                    uniqueItems: false
                  ownerId:
                    type: integer
                  radius:
                    description: For circular geofences, the radius of the circle in meters. Property is ignored if outline != null.
                    type: integer
                  type:
                    type: string
                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
'404':
yaml
          content:
            application/json:
              schema:
                properties:
                  code:
                    example: 400
                    type: integer
                  message:
                    example: status bad request
                    type: string
                type: object
          description: Not Found
'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
yaml
      security:
        - ApiKeyAuth: []
      summary: Gets a single geofence
      tags:
        - geofences
      operationId: get-users-userid-geofences-fenceid
components:
  securitySchemes:
    ApiKeyAuth:
      in: header
      name: Authorization
      type: apiKey
      description: API Key for authentication. Retrieval from either API version login routes, or other authentication token type. See <a href='/apis/authentication'>Authentication</a> for more details.
      example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...