Navegación de documentación
Referencia API
Smartlocker
Codes · Door
Resumen
Utiliza las rutas y métodos siguientes. Sustituye los identificadores de ejemplo y YOUR_API_TOKEN por tus valores autorizados; esta página nunca ejecuta los ejemplos.
URL base
https://api.stayclean.ioAutenticación
Authorization: Basic YOUR_API_TOKEN
/api/v1/properties/{id}/smartlocker/codesListar los códigos Smartlocker de un alojamiento
Devuelve todos los códigos configurados con su estado de sincronización.
Parámetros
| Parámetro | Tipo | Ubicación | Obligatorio | Detalles |
|---|---|---|---|---|
| id | string | Ruta | Sí | Parámetro de ruta obligatorio. |
Límite de 10 peticiones por minuto, 100 por hora y 500 por día.
Parámetros de ruta: {id} (UUID del alojamiento).
Límites de peticiones:10 / minuto100 / hora500 / día
Ejemplo de petición · GET
cURL
curl --request 'GET' 'https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes' \
--header 'Authorization: Basic YOUR_API_TOKEN' \
--header 'Accept: application/json'JavaScript
const response = await fetch("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes", {
"method": "GET",
"headers": {
"Authorization": "Basic YOUR_API_TOKEN",
"Accept": "application/json"
}
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();PHP
<?php
$curl = curl_init('https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array (
0 => 'Authorization: Basic YOUR_API_TOKEN',
1 => 'Accept: application/json',
),
]);
$response = curl_exec($curl);
if ($response === false) throw new RuntimeException(curl_error($curl));
curl_close($curl);
$data = json_decode($response, true, 512, JSON_THROW_ON_ERROR);PYTHON
import json
from urllib.request import Request, urlopen
headers = {
"Authorization": "Basic YOUR_API_TOKEN",
"Accept": "application/json"
}
data = None
request = Request("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes", data=data, headers=headers, method="GET")
with urlopen(request) as response:
result = json.load(response)Ejemplo de respuesta
{
"property_id": "uuid",
"definitions": [
{
"identifier": "vendor",
"label": "Code prestataire",
"description": "Code utilisé par l’équipe de nettoyage."
}
],
"codes": [
{
"identifier": "vendor",
"label": "Code prestataire",
"description": "Code utilisé par l’équipe de nettoyage.",
"code": 123456,
"code_formatted": "123456",
"configured": true,
"synced": true
}
]
}/api/v1/properties/{id}/smartlocker/codesCrear un código Smartlocker
Añade un código para un identificador determinado y lo sincroniza con la cerradura.
Parámetros
| Parámetro | Tipo | Ubicación | Obligatorio | Detalles |
|---|---|---|---|---|
| id | string | Ruta | Sí | Parámetro de ruta obligatorio. |
| identifier | string | Cuerpo | Sí | Identificador de código configurado para el alojamiento.vendor |
| mode | string | Cuerpo | No | Modo de generación del código: random o manual.manual |
| code | string | Cuerpo | No | Obligatorio en modo manual: de 4 a 10 dígitos entre 1 y 7, enviados como cadena.123456 |
| label | string | Cuerpo | No | Etiqueta opcional del código de acceso.Cleaning access |
Límite de 10 peticiones por minuto, 100 por hora y 500 por día.
Parámetros de ruta: {id} (UUID del alojamiento).
Contenido esperado: identifier (string), mode ("random"|"manual"), code (string, obligatorio si mode = manual), label (string opcional).
Límites de peticiones:10 / minuto100 / hora500 / día
Ejemplo de petición · POST
cURL
curl --request 'POST' 'https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes' \
--header 'Authorization: Basic YOUR_API_TOKEN' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"identifier": "vendor",
"mode": "manual",
"code": "123456",
"label": "Code ménage"
}'JavaScript
const response = await fetch("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes", {
"method": "POST",
"headers": {
"Authorization": "Basic YOUR_API_TOKEN",
"Accept": "application/json",
"Content-Type": "application/json"
},
"body": "{\n \"identifier\": \"vendor\",\n \"mode\": \"manual\",\n \"code\": \"123456\",\n \"label\": \"Code ménage\"\n}"
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();PHP
<?php
$curl = curl_init('https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array (
0 => 'Authorization: Basic YOUR_API_TOKEN',
1 => 'Accept: application/json',
2 => 'Content-Type: application/json',
),
CURLOPT_POSTFIELDS => '{
"identifier": "vendor",
"mode": "manual",
"code": "123456",
"label": "Code ménage"
}',
]);
$response = curl_exec($curl);
if ($response === false) throw new RuntimeException(curl_error($curl));
curl_close($curl);
$data = json_decode($response, true, 512, JSON_THROW_ON_ERROR);PYTHON
import json
from urllib.request import Request, urlopen
headers = {
"Authorization": "Basic YOUR_API_TOKEN",
"Accept": "application/json",
"Content-Type": "application/json"
}
payload = json.loads("{\n \"identifier\": \"vendor\",\n \"mode\": \"manual\",\n \"code\": \"123456\",\n \"label\": \"Code ménage\"\n}")
data = json.dumps(payload).encode('utf-8')
request = Request("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes", data=data, headers=headers, method="POST")
with urlopen(request) as response:
result = json.load(response)Ejemplo de respuesta
{
"success": true,
"entry": {
"identifier": "vendor",
"label": "Code ménage",
"code": 123456,
"configured": true,
"synced": true
},
"codes": []
}/api/v1/properties/{id}/smartlocker/codes/{identifier}Eliminar un código Smartlocker
Retira un código del alojamiento y lo elimina de la cerradura inteligente.
Parámetros
| Parámetro | Tipo | Ubicación | Obligatorio | Detalles |
|---|---|---|---|---|
| id | string | Ruta | Sí | Parámetro de ruta obligatorio. |
| identifier | string | Ruta | Sí | Parámetro de ruta obligatorio. |
Límite de 10 peticiones por minuto, 100 por hora y 500 por día.
Parámetros de ruta: {id} (UUID del alojamiento), {identifier} (identificador del código).
Límites de peticiones:10 / minuto100 / hora500 / día
Ejemplo de petición · DELETE
cURL
curl --request 'DELETE' 'https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes/code-id' \
--header 'Authorization: Basic YOUR_API_TOKEN' \
--header 'Accept: application/json'JavaScript
const response = await fetch("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes/code-id", {
"method": "DELETE",
"headers": {
"Authorization": "Basic YOUR_API_TOKEN",
"Accept": "application/json"
}
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();PHP
<?php
$curl = curl_init('https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes/code-id');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array (
0 => 'Authorization: Basic YOUR_API_TOKEN',
1 => 'Accept: application/json',
),
]);
$response = curl_exec($curl);
if ($response === false) throw new RuntimeException(curl_error($curl));
curl_close($curl);
$data = json_decode($response, true, 512, JSON_THROW_ON_ERROR);PYTHON
import json
from urllib.request import Request, urlopen
headers = {
"Authorization": "Basic YOUR_API_TOKEN",
"Accept": "application/json"
}
data = None
request = Request("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes/code-id", data=data, headers=headers, method="DELETE")
with urlopen(request) as response:
result = json.load(response)Ejemplo de respuesta
{
"success": true,
"codes": []
}/api/v1/properties/{id}/smartlocker/codes/{identifier}Actualizar un código Smartlocker
Actualiza la etiqueta o el valor de un código existente y sincroniza la cerradura.
Parámetros
| Parámetro | Tipo | Ubicación | Obligatorio | Detalles |
|---|---|---|---|---|
| id | string | Ruta | Sí | Parámetro de ruta obligatorio. |
| identifier | string | Ruta | Sí | Parámetro de ruta obligatorio. |
| mode | string | Cuerpo | No | Modo de generación del código: random o manual.manual |
| code | string | Cuerpo | No | Obligatorio en modo manual: de 4 a 10 dígitos entre 1 y 7, enviados como cadena.123456 |
| label | string | Cuerpo | No | Etiqueta opcional del código de acceso.Cleaning access |
Límite de 10 peticiones por minuto, 100 por hora y 500 por día.
Parámetros de ruta: {id} (UUID del alojamiento), {identifier} (identificador del código).
Contenido esperado: mode ("random"|"manual"), code (string, obligatorio si mode = manual), label (string opcional).
Límites de peticiones:10 / minuto100 / hora500 / día
Ejemplo de petición · PUT
cURL
curl --request 'PUT' 'https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes/code-id' \
--header 'Authorization: Basic YOUR_API_TOKEN' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"mode": "manual",
"code": "654321",
"label": "Code ménage (soir)"
}'JavaScript
const response = await fetch("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes/code-id", {
"method": "PUT",
"headers": {
"Authorization": "Basic YOUR_API_TOKEN",
"Accept": "application/json",
"Content-Type": "application/json"
},
"body": "{\n \"mode\": \"manual\",\n \"code\": \"654321\",\n \"label\": \"Code ménage (soir)\"\n}"
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();PHP
<?php
$curl = curl_init('https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes/code-id');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array (
0 => 'Authorization: Basic YOUR_API_TOKEN',
1 => 'Accept: application/json',
2 => 'Content-Type: application/json',
),
CURLOPT_POSTFIELDS => '{
"mode": "manual",
"code": "654321",
"label": "Code ménage (soir)"
}',
]);
$response = curl_exec($curl);
if ($response === false) throw new RuntimeException(curl_error($curl));
curl_close($curl);
$data = json_decode($response, true, 512, JSON_THROW_ON_ERROR);PYTHON
import json
from urllib.request import Request, urlopen
headers = {
"Authorization": "Basic YOUR_API_TOKEN",
"Accept": "application/json",
"Content-Type": "application/json"
}
payload = json.loads("{\n \"mode\": \"manual\",\n \"code\": \"654321\",\n \"label\": \"Code ménage (soir)\"\n}")
data = json.dumps(payload).encode('utf-8')
request = Request("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes/code-id", data=data, headers=headers, method="PUT")
with urlopen(request) as response:
result = json.load(response)Ejemplo de respuesta
{
"success": true,
"entry": {
"identifier": "vendor",
"label": "Code ménage (soir)",
"code": 654321,
"configured": true,
"synced": true
},
"codes": []
}/api/v1/properties/{id}/smartlocker/codes/{identifier}/resetRestablecer un código Smartlocker
Genera un nuevo código para el identificador seleccionado y actualiza la cerradura.
Parámetros
| Parámetro | Tipo | Ubicación | Obligatorio | Detalles |
|---|---|---|---|---|
| id | string | Ruta | Sí | Parámetro de ruta obligatorio. |
| identifier | string | Ruta | Sí | Parámetro de ruta obligatorio. |
| mode | string | Cuerpo | No | Modo de generación del código: random o manual.manual |
| code | string | Cuerpo | No | Obligatorio en modo manual: de 4 a 10 dígitos entre 1 y 7, enviados como cadena.123456 |
| label | string | Cuerpo | No | Etiqueta opcional del código de acceso.Cleaning access |
Límite de 10 peticiones por minuto, 100 por hora y 500 por día.
Parámetros de ruta: {id} (UUID del alojamiento), {identifier} (identificador del código).
Contenido esperado: mode ("random"|"manual"), code (string, obligatorio si mode = manual), label (string opcional).
Límites de peticiones:10 / minuto100 / hora500 / día
Ejemplo de petición · POST
cURL
curl --request 'POST' 'https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes/code-id/reset' \
--header 'Authorization: Basic YOUR_API_TOKEN' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"mode": "random"
}'JavaScript
const response = await fetch("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes/code-id/reset", {
"method": "POST",
"headers": {
"Authorization": "Basic YOUR_API_TOKEN",
"Accept": "application/json",
"Content-Type": "application/json"
},
"body": "{\n \"mode\": \"random\"\n}"
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();PHP
<?php
$curl = curl_init('https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes/code-id/reset');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array (
0 => 'Authorization: Basic YOUR_API_TOKEN',
1 => 'Accept: application/json',
2 => 'Content-Type: application/json',
),
CURLOPT_POSTFIELDS => '{
"mode": "random"
}',
]);
$response = curl_exec($curl);
if ($response === false) throw new RuntimeException(curl_error($curl));
curl_close($curl);
$data = json_decode($response, true, 512, JSON_THROW_ON_ERROR);PYTHON
import json
from urllib.request import Request, urlopen
headers = {
"Authorization": "Basic YOUR_API_TOKEN",
"Accept": "application/json",
"Content-Type": "application/json"
}
payload = json.loads("{\n \"mode\": \"random\"\n}")
data = json.dumps(payload).encode('utf-8')
request = Request("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/codes/code-id/reset", data=data, headers=headers, method="POST")
with urlopen(request) as response:
result = json.load(response)Ejemplo de respuesta
{
"success": true,
"entry": {
"identifier": "vendor",
"code": 765432,
"configured": true,
"synced": true
},
"codes": []
}/api/v1/properties/{id}/smartlocker/door/closeCerrar la puerta de un alojamiento
Activa el cierre de la cerradura inteligente conectada al alojamiento.
Parámetros
| Parámetro | Tipo | Ubicación | Obligatorio | Detalles |
|---|---|---|---|---|
| id | string | Ruta | Sí | Parámetro de ruta obligatorio. |
Límite de 10 peticiones por minuto, 100 por hora y 500 por día.
Parámetros de ruta: {id} (UUID del alojamiento).
Límites de peticiones:10 / minuto100 / hora500 / día
Ejemplo de petición · POST
cURL
curl --request 'POST' 'https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/door/close' \
--header 'Authorization: Basic YOUR_API_TOKEN' \
--header 'Accept: application/json'JavaScript
const response = await fetch("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/door/close", {
"method": "POST",
"headers": {
"Authorization": "Basic YOUR_API_TOKEN",
"Accept": "application/json"
}
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();PHP
<?php
$curl = curl_init('https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/door/close');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array (
0 => 'Authorization: Basic YOUR_API_TOKEN',
1 => 'Accept: application/json',
),
]);
$response = curl_exec($curl);
if ($response === false) throw new RuntimeException(curl_error($curl));
curl_close($curl);
$data = json_decode($response, true, 512, JSON_THROW_ON_ERROR);PYTHON
import json
from urllib.request import Request, urlopen
headers = {
"Authorization": "Basic YOUR_API_TOKEN",
"Accept": "application/json"
}
data = None
request = Request("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/door/close", data=data, headers=headers, method="POST")
with urlopen(request) as response:
result = json.load(response)Ejemplo de respuesta
{
"success": true,
"door_open": true,
"door_busy": true
}/api/v1/properties/{id}/smartlocker/door/openAbrir la puerta de un alojamiento
Activa la apertura de la cerradura inteligente conectada al alojamiento.
Parámetros
| Parámetro | Tipo | Ubicación | Obligatorio | Detalles |
|---|---|---|---|---|
| id | string | Ruta | Sí | Parámetro de ruta obligatorio. |
Límite de 10 peticiones por minuto, 100 por hora y 500 por día.
Parámetros de ruta: {id} (UUID del alojamiento).
Límites de peticiones:10 / minuto100 / hora500 / día
Ejemplo de petición · POST
cURL
curl --request 'POST' 'https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/door/open' \
--header 'Authorization: Basic YOUR_API_TOKEN' \
--header 'Accept: application/json'JavaScript
const response = await fetch("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/door/open", {
"method": "POST",
"headers": {
"Authorization": "Basic YOUR_API_TOKEN",
"Accept": "application/json"
}
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();PHP
<?php
$curl = curl_init('https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/door/open');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array (
0 => 'Authorization: Basic YOUR_API_TOKEN',
1 => 'Accept: application/json',
),
]);
$response = curl_exec($curl);
if ($response === false) throw new RuntimeException(curl_error($curl));
curl_close($curl);
$data = json_decode($response, true, 512, JSON_THROW_ON_ERROR);PYTHON
import json
from urllib.request import Request, urlopen
headers = {
"Authorization": "Basic YOUR_API_TOKEN",
"Accept": "application/json"
}
data = None
request = Request("https://api.stayclean.io/api/v1/properties/00000000-0000-4000-8000-000000000000/smartlocker/door/open", data=data, headers=headers, method="POST")
with urlopen(request) as response:
result = json.load(response)Ejemplo de respuesta
{
"success": true,
"door_open": false,
"door_busy": true
}