---
title: "Creating a device."
method: POST
path: "/devices"
tags: ["Devices"]
---

# Creating a device.

`POST /devices`

Creates a device.

## Request body

- CreateDeviceRequest
  - `name` string, required — The name of the device.
  - `location` Location, required — either latitude and longitude is required, or one of streetAddress/city/state
    - `name` string — commmon name to identify location by
    - `latitude` number
    - `longitude` number
    - `streetAddress` string
    - `city` string
    - `state` string
    - `country` string
    - `additionalMetadata` AdditionalMetadata — flat json object, defaults to {} and returned as {} if not provided
      - `type` 'string' | 'number' | 'boolean' — What type the value of the metadata value is
      - `value` object — value of the metadata. Must be a string, number, or boolean
  - `metadata` object — Metadata about the device.

## Response `201`

The device was successfully created.

- Device
  - `id` string, required — The ID of the device.
  - `name` string, required — The name of the device.
  - `location` Location, required — either latitude and longitude is required, or one of streetAddress/city/state
    - `name` string — commmon name to identify location by
    - `latitude` number
    - `longitude` number
    - `streetAddress` string
    - `city` string
    - `state` string
    - `country` string
    - `additionalMetadata` AdditionalMetadata — flat json object, defaults to {} and returned as {} if not provided
      - `type` 'string' | 'number' | 'boolean' — What type the value of the metadata value is
      - `value` object — value of the metadata. Must be a string, number, or boolean
  - `network` Network, required — The network that the device belongs to.
    - `id` string, required — The ID for the network
    - `name` string, required — The name of the network

## Other responses

- `400` — The request is unparsable.
- `401` — The provided token is either expired or invalid.
- `422` — The given request contains one or more errors.
- `429` — The maximum number of requests you can perform per second or the maximum number of devices you can create per day has been exceeded.
- `500` — An internal error happened when processing the request.

---

[API](https://skmtc.net/flocksafety/apis/oauth-api.md) · [All operations](https://skmtc.net/flocksafety/apis/oauth-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/flocksafety/oauth-api/revisions/126df7964ba5/schema)
