Cómo autenticarte y consultar nuestros endpoints desde diferentes lenguajes.
Todas las rutas REST comienzan con:
https://www.crmapi.puntoonline.net/api/v1
Usamos Bearer Tokens (Laravel Sanctum). Primero obtén un token registrándote o iniciando sesión.
POST /api/v1/auth/loginPOST /api/v1/auth/registerIncluye el token en el header Authorization: Bearer
<TOKEN> y añade Accept: application/json.
Reemplaza YOUR_TOKEN por tu token real.
curl -X GET "https://www.crmapi.puntoonline.net/api/v1/dashboard/metrics" \ -H "Accept: application/json" \ -H "Authorization: Bearer YOUR_TOKEN"
fetch("https://www.crmapi.puntoonline.net/api/v1/dashboard/metrics", {
headers: {
Accept: 'application/json',
Authorization: 'Bearer YOUR_TOKEN'
}
}).then(r => r.json()).then(console.log).catch(console.error);
import axios from 'axios';
const api = axios.create({ baseURL: 'https://www.crmapi.puntoonline.net/api/v1' });
const res = await api.get('/dashboard/metrics', {
headers: { Authorization: 'Bearer YOUR_TOKEN' }
});
console.log(res.data);
import requests
url = "https://www.crmapi.puntoonline.net/api/v1/dashboard/metrics"
headers = {"Accept":"application/json","Authorization":"Bearer YOUR_TOKEN"}
r = requests.get(url, headers=headers)
print(r.status_code, r.json())
$client = new \GuzzleHttp\Client(['base_uri' => 'https://www.crmapi.puntoonline.net/api/v1']);
$res = $client->get('/dashboard/metrics', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer YOUR_TOKEN',
],
]);
$body = json_decode($res->getBody()->getContents(), true);
print_r($body);
Authorization o el token es
inválido/caducado.Authorization a PHP o la URL no es correcta.Accept: application/json y
sin depender de cookies de sesión.GET /api/v1/dashboard/metricsGET /api/v1/dashboard/leads-chartGET /api/v1/dashboard/leads-last-30GET /api/v1/dashboard/opportunities-by-stageGET /api/v1/dashboard/clients-by-typePermite que tu sitio (WordPress, Next.js, etc.) nos envíe leads directamente al CRM.
Debes incluir tu ApiKey en el header X-Api-Key. La ApiKey
se gestiona desde Organizaciones. El formulario requiere nombre, email, teléfono y cédula.
Endpoint:
POST /api/v1/contact-form
Headers mínimos:
Content-Type: application/jsonX-Api-Key: <TU_API_KEY>Accept: application/jsonBody JSON:
{
"name": "Jane Doe",
"email": "jane@example.com",
"phone": "0414-1234567",
"identification_number": "V-12345678",
"message": "Estoy interesada en sus servicios",
"client_type_id": 1
}
curl -X POST "https://www.crmapi.puntoonline.net/api/v1/contact-form" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "X-Api-Key: YOUR_API_KEY" \
-d '{"name":"Jane Doe","email":"jane@example.com","phone":"0414-1234567","identification_number":"V-12345678","message":"Hola"}'
await fetch("https://www.crmapi.puntoonline.net/api/v1/contact-form", {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-Api-Key': 'YOUR_API_KEY'
},
body: JSON.stringify({ name: 'Jane Doe', email: 'jane@example.com', phone: '0414-1234567', identification_number: 'V-12345678', message: 'Hola' })
}).then(r => r.json()).then(console.log);
import requests
url = "https://www.crmapi.puntoonline.net/api/v1/contact-form"
headers = {"Content-Type":"application/json","Accept":"application/json","X-Api-Key":"YOUR_API_KEY"}
data = {"name":"Jane Doe","email":"jane@example.com","phone":"0414-1234567","identification_number":"V-12345678","message":"Hola"}
r = requests.post(url, json=data, headers=headers)
print(r.status_code, r.json())
$client = new \GuzzleHttp\Client(['base_uri' => 'https://www.crmapi.puntoonline.net/api/v1']);
$res = $client->post('/contact-form', [
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-Api-Key' => 'YOUR_API_KEY',
],
'json' => [ 'name' => 'Jane Doe', 'email' => 'jane@example.com', 'phone' => '0414-1234567', 'identification_number' => 'V-12345678', 'message' => 'Hola' ]
]);
echo $res->getStatusCode();
Respuesta 201:
{
"status": "success",
"message": "Formulario recibido correctamente",
"client": {
"id": 123,
"name": "Jane Doe",
"email": "jane@example.com"
},
"organization": {
"id": 5,
"name": "Mi Organización"
}
}