Referencia
Negocio
Datos del negocio dueño de la API key y sus locales.
- GET
/v1/business· Obtener el negocio - GET
/v1/locations· Listar locales - GET
/v1/locations/{id}· Obtener un local
Obtener el negocio
GET/v1/business
Devuelve el negocio al que pertenece la API key (zona horaria, moneda y enlace de reservas).
Ejemplo
curl https://api.mihoraya.com/v1/business \
-H "Authorization: Bearer $MIHORAYA_API_KEY"JavaScript (Node.js 18+)
const res = await fetch("https://api.mihoraya.com/v1/business", {
headers: {
Authorization: `Bearer ${process.env.MIHORAYA_API_KEY}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.error.code}: ${data.error.message} (${data.error.request_id})`);
console.log(data);Python (requests)
import os
import requests
res = requests.get(
"https://api.mihoraya.com/v1/business",
headers={"Authorization": f"Bearer {os.environ['MIHORAYA_API_KEY']}"},
timeout=30,
)
data = res.json()
if not res.ok:
raise RuntimeError(f"{data['error']['code']}: {data['error']['message']}")
print(data)PHP (cURL)
<?php
$ch = curl_init('https://api.mihoraya.com/v1/business');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('MIHORAYA_API_KEY'),
],
]);
$data = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($status >= 400) {
throw new RuntimeException($data['error']['code'] . ': ' . $data['error']['message']);
}
print_r($data);Respuesta de ejemplo (200)
{
"id": 42,
"object": "business",
"name": "Estudio Lumière",
"slug": "estudio-lumiere",
"description": "Peluquería y estética en Providencia.",
"industry": "peluqueria",
"country": "CL",
"time_zone": "America/Santiago",
"currency": {
"code": "CLP",
"decimals": 0
},
"logo_url": "",
"booking_url": "https://mihoraya.com/estudio-lumiere",
"livemode": true,
"created_at": "2026-03-02T09:15:00-03:00"
}Respuestas
- 200 OK · El negocio.
- 401 No autenticado · API key ausente, inválida (
invalid_api_key), revocada (api_key_revoked) o vencida (api_key_expired). - 402 Plan · El plan del negocio no incluye la API (
feature_locked) o se alcanzó un límite del plan (limit_reached). - 403 Sin permiso · La API key no tiene el permiso necesario (
insufficient_scope). - 429 Demasiadas llamadas · Se superó el límite por minuto (
rate_limited) o la cuota mensual del plan (quota_exceeded).
Listar locales
GET/v1/locations
Locales (sucursales) del negocio con su horario semanal.
Parámetros
| Nombre | En | Tipo | Descripción |
|---|---|---|---|
limit | query | integer | Elementos por página (1 a 100). Por defecto: 25 · Entre 1 y 100 |
cursor | query | string | Valor next_cursor de la página anterior. |
Ejemplo
curl https://api.mihoraya.com/v1/locations \
-H "Authorization: Bearer $MIHORAYA_API_KEY"JavaScript (Node.js 18+)
const res = await fetch("https://api.mihoraya.com/v1/locations", {
headers: {
Authorization: `Bearer ${process.env.MIHORAYA_API_KEY}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.error.code}: ${data.error.message} (${data.error.request_id})`);
console.log(data);Python (requests)
import os
import requests
res = requests.get(
"https://api.mihoraya.com/v1/locations",
headers={"Authorization": f"Bearer {os.environ['MIHORAYA_API_KEY']}"},
timeout=30,
)
data = res.json()
if not res.ok:
raise RuntimeError(f"{data['error']['code']}: {data['error']['message']}")
print(data)PHP (cURL)
<?php
$ch = curl_init('https://api.mihoraya.com/v1/locations');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('MIHORAYA_API_KEY'),
],
]);
$data = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($status >= 400) {
throw new RuntimeException($data['error']['code'] . ': ' . $data['error']['message']);
}
print_r($data);Respuesta de ejemplo (200)
{
"object": "list",
"data": [
{
"id": 7,
"object": "location",
"name": "Providencia",
"address": "Av. Providencia 1234, Santiago",
"phone": "+56 2 2345 6789",
"email": "providencia@example.com",
"description": "",
"time_zone": "America/Santiago",
"hours": [
{
"weekday": 1,
"opens": "09:00",
"closes": "20:00",
"closed": false
},
{
"weekday": 0,
"opens": "09:00",
"closes": "14:00",
"closed": true
}
],
"created_at": "2026-03-02T09:15:00-03:00"
}
],
"has_more": false,
"next_cursor": null
}Respuestas
- 200 OK · Página de locales.
- 400 Petición inválida · Parámetros inválidos (
parameter_invalid,parameter_missing,parameter_unknown,invalid_body,idempotency_key_required). - 401 No autenticado · API key ausente, inválida (
invalid_api_key), revocada (api_key_revoked) o vencida (api_key_expired). - 402 Plan · El plan del negocio no incluye la API (
feature_locked) o se alcanzó un límite del plan (limit_reached). - 403 Sin permiso · La API key no tiene el permiso necesario (
insufficient_scope). - 429 Demasiadas llamadas · Se superó el límite por minuto (
rate_limited) o la cuota mensual del plan (quota_exceeded).
Obtener un local
GET/v1/locations/{id}
Parámetros
| Nombre | En | Tipo | Descripción |
|---|---|---|---|
id obligatorio | ruta | integer |
Ejemplo
curl https://api.mihoraya.com/v1/locations/7 \
-H "Authorization: Bearer $MIHORAYA_API_KEY"JavaScript (Node.js 18+)
const res = await fetch("https://api.mihoraya.com/v1/locations/7", {
headers: {
Authorization: `Bearer ${process.env.MIHORAYA_API_KEY}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.error.code}: ${data.error.message} (${data.error.request_id})`);
console.log(data);Python (requests)
import os
import requests
res = requests.get(
"https://api.mihoraya.com/v1/locations/7",
headers={"Authorization": f"Bearer {os.environ['MIHORAYA_API_KEY']}"},
timeout=30,
)
data = res.json()
if not res.ok:
raise RuntimeError(f"{data['error']['code']}: {data['error']['message']}")
print(data)PHP (cURL)
<?php
$ch = curl_init('https://api.mihoraya.com/v1/locations/7');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('MIHORAYA_API_KEY'),
],
]);
$data = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($status >= 400) {
throw new RuntimeException($data['error']['code'] . ': ' . $data['error']['message']);
}
print_r($data);Respuestas
- 200 OK · El local.
- 401 No autenticado · API key ausente, inválida (
invalid_api_key), revocada (api_key_revoked) o vencida (api_key_expired). - 402 Plan · El plan del negocio no incluye la API (
feature_locked) o se alcanzó un límite del plan (limit_reached). - 403 Sin permiso · La API key no tiene el permiso necesario (
insufficient_scope). - 404 No encontrado · El recurso no existe o es de otro negocio (
resource_not_found). - 429 Demasiadas llamadas · Se superó el límite por minuto (
rate_limited) o la cuota mensual del plan (quota_exceeded).
Objetos
El objeto Business
| Campo | Tipo | Descripción |
|---|---|---|
id | integer | |
object | string | Siempre business |
name | string | |
slug | string | |
description | string | |
industry | string | |
country | string | ISO 3166-1 alfa-2 |
time_zone | string | Zona IANA del negocio. |
currency | object | |
currency.code | string | |
currency.decimals | integer | |
logo_url | string | |
booking_url | string (uri) | |
livemode | boolean | false con una clave de prueba. |
created_at | string (date-time) |
El objeto Location
| Campo | Tipo | Descripción |
|---|---|---|
id | integer | |
object | string | Siempre location |
name | string | |
address | string | |
phone | string | |
email | string | |
description | string | |
time_zone | string | |
hours | array de OpeningHours | |
created_at | string (date-time) |
El objeto OpeningHours
| Campo | Tipo | Descripción |
|---|---|---|
weekday | integer | 0 = domingo … 6 = sábado Entre 0 y 6 |
opens | string | |
closes | string | |
closed | boolean |