# Restricted Requests


# Create Clients

# Parameters:

Name Type Description Required
token String user's Monuv token (is a query string parameter)
name String The name of the Client
document_type Integer The document type of the Client
1 = CPF
2 = CNPJ
document_number String The document number of the Client
phone String The phone of the Client
cep String CEP of the Client
address String Address of the Client
address_number String The address number of the Client
address_comp String The address complement of the Client
address_nh String The neighborhood of the Client
city String The city of the Client
state String The state of the Client
users List After creating the client, a user will be created in the client
A list of objects (Same rules of create user)

# Response:

Status code Description
201 Client created successfully
400 Bad Request
422 Unprocessable Entity
500 Internal Error
[
    {
		"id": 1,
		"name": "Client name",
		"document_type": "2",
		"document_number": "99.999.999/9999-99",
		"phone": "(11) 99999-9999",
		"cep": "00000-000",
		"address": "Rua Teste",
		"address_number": "99",
		"address_nh": "Bairro",
		"city": "São Paulo",
		"state": "São Paulo",
		"create_url": "https://my.site.com",
		"create_ip": "127.0.0.1",
		"updated_at": "2023-01-01 12:00:00",
		"created_at": "2023-01-01 12:00:00",
		"users": [ // if passed information for user creation
			{
				"id": 2,
				"user_type_id": 6,
				"name": "My Name",
				"email": "my@email.com.br",
				"phone": "11999999999",
				"updated_at": "2023-01-01 12:00:00",
				"created_at": "2023-01-01 12:00:00",
				"update_user_id": 1,
				"api_token": "TOKEN"
			}
		]
	}
]

# Create Client Users

# Parameters:

Name Type Description Required
token String user's Monuv token (is a query string parameter)
name String The name of the User
email String The e-mail of The User
phone String The phone of the User
user_type Integer 1 = COMUM
2 = ADMIN
password String The password of the User
password_conf String Confirmation of the user's password, must be equal to the value of the password field

# Response:

Status code Description
201 Client user created successfully
400 Bad Request
422 Unprocessable Entity
500 Internal Error
[
    {
		"id": 2,
		"user_type_id": 6, // 6 = Client
		"name": "user name",
		"email": "user@email.com.br",
		"phone": "(11) 99999-9999",
		"updated_at": "2023-01-01 12:00:00",
		"created_at": "2023-01-01 12:00:00",
		"update_user_id": 1
	}
]

# Block/Unblock partner's clients

Gives and revokes access to certain partner's clients

# Parameters:

Name Type Description Required
token String partners token
document String partner's clients document (CPF or CNPJ, numbers only)

# Response:

Name Type Description
CODE String return code
MSG String in case of error, related error message
{
    "code": 0,
    "msg": ""
}

# Code example

curl --location 'https://app.monuv.com.br/api/client/block/{token}/{document}'
const axios = require('axios');
const FormData = require('form-data');
let data = new FormData();

let config = {
		method: 'get',
		maxBodyLength: Infinity,
		url: 'https://app.monuv.com.br/api/client/block/{token}/{document}',
};

axios.request(config)
.then((response) => {
		console.log(JSON.stringify(response.data));
})
.catch((error) => {
		console.log(error);
});
import requests

url = "https://app.monuv.com.br/api/client/block/{token}/{document}"

response = requests.request("GET", url)

print(response.text)

# Block/Unblock Users

Gives and revokes access to certain users

# Parameters:

Name Type Description Required
token String user token
id String user id

# Response:

Name Type Description
CODE String return code
MSG String in case of error, related error message
{
    "code": 0,
    "msg": ""
}

# Code example

curl --location 'https://app.monuv.com.br/api/user/block/{token}/{id}'
curl --location 'https://app.monuv.com.br/api/user/unblock/{token}/{id}'
const axios = require('axios');
const FormData = require('form-data');
let data = new FormData();

let config = {
		method: 'get',
		maxBodyLength: Infinity,
		url: 'https://app.monuv.com.br/api/user/block/{token}/{id}',
};

axios.request(config)
.then((response) => {
		console.log(JSON.stringify(response.data));
})
.catch((error) => {
		console.log(error);
});
import requests

url = "https://app.monuv.com.br/api/user/block/{token}/{id}"

response = requests.request("GET", url)

print(response.text)

# Information to Create/Update cameras

Retrieve informations necessary to create/update a camera

# Parameters:

Name Type Description Required
token String user's Monuv token (is a query string parameter)

# Response:

Status code Description
200 Success
500 Internal Error
{
	"manufacturer": [
		{
			"id": 5,
			"name": "Hikvision",
			"camera_model": [
				{
					"id": 6,
					"name": "Câmera IP",
					"manufacturer_id": 5
				},
				{
					"id": 25,
					"name": "DVR",
					"manufacturer_id": 5
				},
				...
			]
		},
		{
			"id": 22,
			"name": "Generico",
			"camera_model": [
				{
					"id": 39,
					"name": "Camera IP",
					"manufacturer_id": 22
				},
				{
					"id": 40,
					"name": "DVR",
					"manufacturer_id": 22
				}
			]
		},
		...
	],
	"plans": {
		"history_days": [
			1,
			3,
			7,
			...
		],
		"resolutions": [
			{
				"id": 1,
				"name": "VGA"
			},
			...
		]
	},
	"installation_info": {
		"installation_local": {
			"1": "Privado (dentro de dependências privadas)",
			"2": "Público (ruas, praças, etc)"
		},
		"installation_area": {
			"1": "Área interna",
			"2": "Área externa"
		},
		"equipment_state": {
			"1": "Câmera\/DVR novo",
			"2": "Câmera\/DVR pré-existente"
		}
	}
}

# Create Cameras

# Parameters:

Name Type Description Required
token String user's Monuv token (is a query string parameter)
demo Boolean Send TRUE when camera is used for testing, limit 1 camera DEMO per account Default FALSE
description String The name of the Camera
camera_address String The address of the Camera
latitude String The latitude of the camera address
longitude String The longitude of the camera address
connection_type Integer The Camera connection type
0 = RTSP
1 = RTMP
2 = P2P
resolution_id Integer The Camera resolution ID
To consult the list of available resolution, see: Information to create cameras
history_days Integer Number of days that camera recordings will be stored
To consult the available list, see: Information to create cameras
channel Integer DVR Channel number (Camera RTSP)
model_id Integer Camera Model Identifier
To consult the list of available models, see: Information to create cameras
Required when connection_type is 0 (RTSP)
dns String DNS or IP to access camera video stream Required when connection_type is 0 (RTSP) or typed_url is not defined
port String Network port to access camera video stream Required when connection_type is 0 (RTSP) or typed_url is not defined
user String Camera RTSP user Required when connection_type is 0 (RTSP) or typed_url is not defined
pass String Camera RTSP password Required when connection_type is 0 (RTSP) or typed_url is not defined
typed_url String Full camera RTSP URL
stream String Camera stream type
0 = Main
1 = Secondary
Required when connection_type is 0 (RTSP) or 2 (P2P)
p2p_serial_number String Camera P2P Serial Number Required when connection_type is 2 (P2P)
p2p_password String Camera P2P password Required when connection_type is 2 (P2P)
sound Integer Enable camera sound recording and reproduction (For RTMP and P2P only - Ensure camera is set o AAC Audio Codec)
0 = Disabled
1 = Enabled

# Response:

Status code Description
201 Camera created successfully
400 Bad Request
422 Unprocessable Entity
500 Internal Error
[
    {
		"id": 1,
		"description": "My camera",
		"stream_status": 2,
		"status_description": "OFFLINE",
		"rtmp_url": "rtmp://rtmp.monuv.com.br/my.stream" # Only for RTMP Cameras
	}
]

# Update Cameras

# Parameters:

Name Type Description Required
token String user's Monuv token (is a URL parameter)
id String Id camera (is a query string parameter)
description String The name of the Camera
camera_address String The address of the Camera
latitude String The latitude of the camera address
longitude String The longitude of the camera address
connection_type Integer The Camera connection type
0 = RTSP
1 = RTMP
2 = P2P
resolution_id Integer The Camera resolution ID
To consult the list of available resolution, see: Information to update cameras
history_days Integer Number of days that camera recordings will be stored
To consult the available list, see: Information to update cameras
client_id Integer The camera owner Client ID Required when demo is FALSE
channel Integer DVR Channel number (Camera RTSP)
model_id Integer Camera Model Identifier
To consult the list of available models, see: Information to update cameras
Required when connection_type is 0 (RTSP)
dns String DNS or IP to access camera video stream Required when connection_type is 0 (RTSP) or typed_url is not defined
port String Network port to access camera video stream Required when connection_type is 0 (RTSP) or typed_url is not defined
user String Camera RTSP user Required when connection_type is 0 (RTSP) or typed_url is not defined
pass String Camera RTSP password Required when connection_type is 0 (RTSP) or typed_url is not defined
typed_url String Full camera RTSP URL
stream String Camera stream type
0 = Main
1 = Secondary
Required when connection_type is 0 (RTSP) or 2 (P2P)
p2p_serial_number String Camera P2P Serial Number Required when connection_type is 2 (P2P)
p2p_password String Camera P2P password Required when connection_type is 2 (P2P)
sound Integer Enable camera sound recording and reproduction (For RTMP and P2P only - Ensure camera is set o AAC Audio Codec)
0 = Disabled
1 = Enabled

# Response:

Status code Description
201 Camera updated successfully
400 Bad Request
422 Unprocessable Entity
500 Internal Error
[
    {
		"id": 1,
		"description": "My camera",
		"stream_status": 2,
		"status_description": "OFFLINE",
		"rtmp_url": "rtmp://rtmp.monuv.com.br/my.stream" # Only for RTMP Cameras
	}
]

# List Events

Return a paginated list of events

# Parameters:

Name Type Description Required
token String user's Monuv token (is a query string parameter)
event_types String List of event type IDs (The ids must be separated by a comma, e.g.: 1,4)
1 = Alerta Câmera
2 = Pânico
4 = Detecção Presença/Ausência
5 = Detecção Movimento
7 = LPR
13 = Anomalia
camera int Camera ID
start_at string filter events by start date (Y-m-d)
end_at string filter events by end date (Y-m-d)
page int Pagination page number
(Default 1)

# Response:

Status code Description
200 OK
500 Internal Error
[
    {
		"total": 100, // total events
		"per_page": 30, // Event per page
		"current_page": 1,
		"last_page": 4,
		"data": [
			{
				"id": 1,
				"event_at": "01/01/2023 12:00:00",
				"event_type": 4,
				"event_description": "Detecção Presença/Ausência",
				"event_url": "https://detection.monuv.com.br/IMAGE_PATH.jpg",
				"camera_id": 1001,
				"camera_description": "My Camera"
			},
			...
		]
	}
]

# Code example:

curl --request GET \
  --url 'https://app.monuv.com.br/api/v1/events?camera=1001&event_types=1%2C4&start_at=2023-01-01&end_at=2023-01-02&page=2&token={TOKEN}'
const axios = require('axios');
const FormData = require('form-data');
let data = new FormData();

axios.get('https://app.monuv.com.br/api/v1/events', {
	'camera': 1001,
	'event_types': '1,4',
	'start_at': '2023-01-01',
	'end_at': '2023-01-02',
	'page': 2
})
.then((response) => {
		console.log(JSON.stringify(response.data));
})
.catch((error) => {
		console.log(error);
});
import requests

url = "https://app.monuv.com.br/api/v1/events"

params = {
	'camera': 1001,
	'event_types': '1,4',
	'start_at': '2023-01-01',
	'end_at': '2023-01-02',
	'page': 2
}

response = requests.get(url, params)

print(response.json())