Para acceder a los endpoints autenticados, necesitas una API Key. Se genera automáticamente al registrarte y la encuentras en tu Dashboard.
Authorization: Bearer tu-api-key
/api/share
Público
Comparte texto o archivo sin necesidad de autenticación. Puedes enviar texto, archivo, o ambos.
Request (solo texto):
POST /api/share
Content-Type: application/json
{ "content": "Hola mundo" }
Request (con archivo):
POST /api/share Content-Type: multipart/form-data content: "Hola mundo" file: <archivo>
Response:
{
"id": "aB3xK7z",
"url": "https://share.spacehowen.com/aB3xK7z",
"iframe_html": "<iframe src=\"https://share.spacehowen.com/aB3xK7z\" style=\"width:100%;height:360px;border:0\"></iframe>"
}
/api/share
Autenticado
Comparte con autenticación. Obtienes estadísticas, tracking de vistas, slug personalizado y expiración configurable.
Request:
POST /api/share
Content-Type: application/json
Authorization: Bearer tu-api-key
{
"content": "Hola mundo",
"slug": "mi-post",
"expires_in": "7d"
}
Response:
{
"id": "mi-post",
"url": "https://share.spacehowen.com/mi-post",
"stats_url": "https://share.spacehowen.com/dashboard/stats/mi-post",
"iframe_html": "<iframe src=\"https://share.spacehowen.com/mi-post\" style=\"width:100%;height:360px;border:0\"></iframe>"
}
expires_in opcional: 5m, 30m, 1h, 5h, 24h, 3d, 7d, permanent
slug opcional: string de 3-100 caracteres (letras, números, guiones). Ej: "slug": "mi-post"
Todos los errores devuelven un objeto JSON con el campo error.
Ejemplo:
{ "error": "Contenido requerido" }
400 — Contenido o archivo requerido
422 — Slug inválido
401 — API Key inválida o faltante
409 — Slug ya en uso
413 — Archivo demasiado grande
404 — Post no encontrado
/api/stats/{code}
Autenticado
Obtén estadísticas de un post.
Response:
{
"content": "Hola mundo",
"views": 42,
"unique_views": 35,
"countries": [{ "country": "Mexico", "total": 20 }],
"referers": [{ "referer": "twitter.com", "total": 15 }],
"timeline": [{ "date": "2026-06-01", "total": 5 }],
"created_at": "2026-06-01 12:00:00",
"expires_at": "2026-07-01 12:00:00"
}
/api/posts
Autenticado
Lista todos tus posts.
[
{
"id": 1,
"unique_id": "aB3xK7z",
"type": "text",
"views_total": 42,
"expires_at": "2026-07-01 12:00:00",
"created_at": "2026-06-01 12:00:00"
}
]
/api/posts/{id}
Autenticado
Elimina uno de tus posts.
Response:
{ "deleted": true }
cURL
curl -X POST https://share.spacehowen.com/api/share \
-H "Content-Type: application/json" \
-d '{"content":"Hola mundo"}'
JavaScript (fetch)
fetch('https://share.spacehowen.com/api/share', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ content: 'Hola mundo' })
}).then(r => r.json()).then(console.log);
PHP
$ch = curl_init('https://share.spacehowen.com/api/share');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode(['content' => 'Hola mundo']),
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_RETURNTRANSFER => true,
]);
$res = curl_exec($ch);
curl_close($ch);
$data = json_decode($res, true);
echo $data['url'];
Python
import requests
r = requests.post('https://share.spacehowen.com/api/share', json={
'content': 'Hola mundo'
})
print(r.json()['url'])
cURL
curl -X POST https://share.spacehowen.com/api/share \
-H "Content-Type: application/json" \
-H "Authorization: Bearer tu-api-key" \
-d '{"content":"Hola mundo","slug":"mi-post","expires_in":"7d"}'
JavaScript (fetch)
fetch('https://share.spacehowen.com/api/share', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer tu-api-key'
},
body: JSON.stringify({
content: 'Hola mundo',
slug: 'mi-post',
expires_in: '7d'
})
}).then(r => r.json()).then(console.log);
PHP
$ch = curl_init('https://share.spacehowen.com/api/share');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode([
'content' => 'Hola mundo',
'slug' => 'mi-post',
'expires_in' => '7d'
]),
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Authorization: Bearer tu-api-key'
],
CURLOPT_RETURNTRANSFER => true,
]);
$res = curl_exec($ch);
curl_close($ch);
$data = json_decode($res, true);
echo $data['url'];
Python
import requests
r = requests.post('https://share.spacehowen.com/api/share', json={
'content': 'Hola mundo',
'slug': 'mi-post',
'expires_in': '7d'
}, headers={
'Authorization': 'Bearer tu-api-key'
})
print(r.json()['url'])