Guía rápida: tu primera llamada a la API en 5 minutos

Crea una llave, pruébala, crea un lead, lista tus leads y suscríbete a un webhook. Solo necesitas una terminal (o cualquier herramienta HTTP) y una cuenta de SpaceKru en un plan de pago o en su prueba gratuita.

La API de SpaceKru (v1.1) es una API REST/JSON disponible en todos los planes de pago de SpaceKru. Sincroniza leads en ambos sentidos (upsert por external_id), añade leads a campañas, crea y mueve deals y pide seguimientos a los Empleados de IA, gestiona productos, cotizaciones, órdenes, pagos y reservas, permite que tu plataforma converse con tu Empleado de IA de Customer Service y envía webhooks firmados para 16 eventos que dicen quién causó cada cambio. URL base: https://app.spacekru.com/api/public/v1. Autenticación: llave de API Bearer (sk_live_…). Documentación: https://www.spacekru.com/es/developers. OpenAPI 3.1: https://app.spacekru.com/api/public/v1/openapi.json.

Read in English

1. Crea una llave de API

  1. Abre el panel. En SpaceKru, ve a Integraciones → API y Webhooks.
  2. Crea la llave. Haz clic en Crear llave, ponle el nombre de la herramienta que la usará (por ejemplo "Guía rápida" o "Zapier") y elige Lectura y escritura.
  3. Cópiala ahora. La llave (sk_live_…) se muestra una sola vez. Cópiala y guárdala en un gestor de contraseñas o en los secretos de tu servidor. Si la pierdes, revócala y crea otra.

Luego déjala disponible en tu terminal como variable de entorno; nunca pegues una llave en código que subas a un repositorio:

macOS / Linux
export SPACEKRU_API_KEY="sk_live_your_key_here"
Windows (PowerShell)
$env:SPACEKRU_API_KEY = "sk_live_your_key_here"

2. Prueba la llave

GET /ping te dice a qué cuenta pertenece la llave, su plan y los permisos de la llave.

curl
curl "https://app.spacekru.com/api/public/v1/ping" \
  -H "Authorization: Bearer $SPACEKRU_API_KEY"
Node.js
const res = await fetch('https://app.spacekru.com/api/public/v1/ping', {
  headers: {
    Authorization: `Bearer ${process.env.SPACEKRU_API_KEY}`,
  },
});
const body = await res.json();
if (!res.ok) {
  // Branch on body.error.code; quote body.error.request_id to support.
  throw new Error(`${body.error.code}: ${body.error.message} (request ${body.error.request_id})`);
}
console.log(body);
Python
import os

import requests

r = requests.get(
    "https://app.spacekru.com/api/public/v1/ping",
    headers={
        "Authorization": f"Bearer {os.environ['SPACEKRU_API_KEY']}",
    },
    timeout=30,
)
body = r.json()
if not r.ok:
    # Branch on body["error"]["code"]; quote body["error"]["request_id"] to support.
    raise RuntimeError(f"{body['error']['code']}: {body['error']['message']} (request {body['error']['request_id']})")
print(body)
Respuesta 200
{
  "object": "ping",
  "organization_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "name": "Acme Corp",
  "plan": "Business",
  "scopes": [
    "read",
    "write"
  ]
}

3. Crea un lead

Envía al menos una forma de contactar a la persona (correo, teléfono o perfil social). external_id es el id de esa persona en TU sistema (opcional). El header Idempotency-Key hace que reintentar sea seguro: si se envía dos veces, solo se crea un lead.

curl
curl -X POST "https://app.spacekru.com/api/public/v1/leads" \
  -H "Authorization: Bearer $SPACEKRU_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: typeform-resp-8f2a1c" \
  -d '{
  "full_name": "Maria Lopez",
  "work_email": "maria.lopez@example.com",
  "work_phone": "+13055550142",
  "company_name": "Acme Corp",
  "job_title": "Operations Manager",
  "city": "Miami",
  "country": "United States",
  "tags": [
    "typeform",
    "spring-promo"
  ],
  "external_id": "crm-88412",
  "initial_note": "Asked for a demo from the spring promo form."
}'
Node.js
const res = await fetch('https://app.spacekru.com/api/public/v1/leads', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.SPACEKRU_API_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': 'typeform-resp-8f2a1c',
  },
  body: JSON.stringify({
    "full_name": "Maria Lopez",
    "work_email": "maria.lopez@example.com",
    "work_phone": "+13055550142",
    "company_name": "Acme Corp",
    "job_title": "Operations Manager",
    "city": "Miami",
    "country": "United States",
    "tags": [
      "typeform",
      "spring-promo"
    ],
    "external_id": "crm-88412",
    "initial_note": "Asked for a demo from the spring promo form."
  }),
});
const body = await res.json();
if (!res.ok) {
  // Branch on body.error.code; quote body.error.request_id to support.
  throw new Error(`${body.error.code}: ${body.error.message} (request ${body.error.request_id})`);
}
console.log(body);
Python
import os

import requests

r = requests.post(
    "https://app.spacekru.com/api/public/v1/leads",
    headers={
        "Authorization": f"Bearer {os.environ['SPACEKRU_API_KEY']}",
        "Idempotency-Key": "typeform-resp-8f2a1c",
    },
    json={
        "full_name": "Maria Lopez",
        "work_email": "maria.lopez@example.com",
        "work_phone": "+13055550142",
        "company_name": "Acme Corp",
        "job_title": "Operations Manager",
        "city": "Miami",
        "country": "United States",
        "tags": ["typeform", "spring-promo"],
        "external_id": "crm-88412",
        "initial_note": "Asked for a demo from the spring promo form.",
    },
    timeout=30,
)
body = r.json()
if not r.ok:
    # Branch on body["error"]["code"]; quote body["error"]["request_id"] to support.
    raise RuntimeError(f"{body['error']['code']}: {body['error']['message']} (request {body['error']['request_id']})")
print(body)
Respuesta 201
{
  "object": "lead",
  "id": "3f2b8c1e-9a4d-4e6f-b7a8-1c2d3e4f5a6b",
  "type": "person",
  "full_name": "Maria Lopez",
  "business_name": null,
  "job_title": "Operations Manager",
  "work_email": "maria.lopez@example.com",
  "personal_email": null,
  "work_phone": "+13055550142",
  "personal_phone": null,
  "company_name": "Acme Corp",
  "city": "Miami",
  "country": "United States",
  "status": "new",
  "source": "api",
  "tags": [
    "typeform",
    "spring-promo"
  ],
  "instagram_profile": null,
  "linkedin_profile_url": null,
  "website": null,
  "external_id": "crm-88412",
  "created_at": "2026-10-19T14:32:10.000Z",
  "updated_at": "2026-10-19T14:32:10.000Z"
}

Ejecútala una segunda vez con una Idempotency-Key distinta: SpaceKru reconoce el mismo correo y responde 409 DUPLICATE_RESOURCE con el existing_id del lead, sin duplicarlo. Más en Idempotencia y duplicados.

4. Lista tus leads

curl
curl "https://app.spacekru.com/api/public/v1/leads?limit=5" \
  -H "Authorization: Bearer $SPACEKRU_API_KEY"
Node.js
const res = await fetch('https://app.spacekru.com/api/public/v1/leads?limit=5', {
  headers: {
    Authorization: `Bearer ${process.env.SPACEKRU_API_KEY}`,
  },
});
const body = await res.json();
if (!res.ok) {
  // Branch on body.error.code; quote body.error.request_id to support.
  throw new Error(`${body.error.code}: ${body.error.message} (request ${body.error.request_id})`);
}
console.log(body);
Python
import os

import requests

r = requests.get(
    "https://app.spacekru.com/api/public/v1/leads?limit=5",
    headers={
        "Authorization": f"Bearer {os.environ['SPACEKRU_API_KEY']}",
    },
    timeout=30,
)
body = r.json()
if not r.ok:
    # Branch on body["error"]["code"]; quote body["error"]["request_id"] to support.
    raise RuntimeError(f"{body['error']['code']}: {body['error']['message']} (request {body['error']['request_id']})")
print(body)

Del más reciente al más antiguo. Cuando has_more es true, pasa next_cursor como cursor para la siguiente página (hasta 100 por página). Mira Paginación y sincronización.

5. Recibe avisos de leads nuevos

Los webhooks envían eventos a una URL tuya. Necesitas una URL pública https:// que responda 200; para una primera prueba sirve una URL de Catch Hook de Zapier o tu propio servidor. Luego suscríbela una vez:

curl
curl -X POST "https://app.spacekru.com/api/public/v1/subscriptions" \
  -H "Authorization: Bearer $SPACEKRU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "event_type": "lead.created",
  "target_url": "https://hooks.zapier.com/hooks/catch/1234567/abcdefg/"
}'
Node.js
const res = await fetch('https://app.spacekru.com/api/public/v1/subscriptions', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.SPACEKRU_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "event_type": "lead.created",
    "target_url": "https://hooks.zapier.com/hooks/catch/1234567/abcdefg/"
  }),
});
const body = await res.json();
if (!res.ok) {
  // Branch on body.error.code; quote body.error.request_id to support.
  throw new Error(`${body.error.code}: ${body.error.message} (request ${body.error.request_id})`);
}
console.log(body);
Python
import os

import requests

r = requests.post(
    "https://app.spacekru.com/api/public/v1/subscriptions",
    headers={
        "Authorization": f"Bearer {os.environ['SPACEKRU_API_KEY']}",
    },
    json={
        "event_type": "lead.created",
        "target_url": "https://hooks.zapier.com/hooks/catch/1234567/abcdefg/",
    },
    timeout=30,
)
body = r.json()
if not r.ok:
    # Branch on body["error"]["code"]; quote body["error"]["request_id"] to support.
    raise RuntimeError(f"{body['error']['code']}: {body['error']['message']} (request {body['error']['request_id']})")
print(body)
Respuesta 201
{
  "object": "subscription",
  "id": "0a1b2c3d-4e5f-4a6b-9c7d-8e9f0a1b2c3d",
  "event_type": "lead.created",
  "target_url": "https://hooks.zapier.com/hooks/catch/1234567/abcdefg/",
  "is_active": true,
  "failure_count": 0,
  "disabled_reason": null,
  "last_success_at": null,
  "created_at": "2026-10-19T14:40:00.000Z",
  "exclude_own_changes": false,
  "secret": "whsec_EXAMPLE0nlyN0tARealSecretDoNotUseIt00000"
}

Ahora crea otro lead (paso 3, con un correo y una Idempotency-Key nuevos): en segundos tu URL recibe un evento lead.created. Tu suscripción también aparece en Integraciones → API y Webhooks, donde puedes quitarla.

Siguientes pasos