Ir al contenido
docs

Cuenta, API key y frescura de los datos

Cualquier API key válida.

GET /public/v1/me

Cualquier API key válida · Cuenta

Ejemplo de petición

Terminal
curl "https://api.posdata.so/public/v1/me" \
  -H "Authorization: Bearer $POSDATA_API_KEY"
JavaScript
const res = await fetch('https://api.posdata.so/public/v1/me', {
  headers: {
    Authorization: `Bearer ${process.env.POSDATA_API_KEY}`,
  },
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.error.code}: ${data.error.message} (${data.error.request_id})`);
Python
import os

import requests

res = requests.get(
    "https://api.posdata.so/public/v1/me",
    headers={
        "Authorization": f"Bearer {os.environ['POSDATA_API_KEY']}",
    },
    timeout=30,
)
data = res.json()
if not res.ok:
    raise RuntimeError(f"{data['error']['code']}: {data['error']['message']} ({data['error']['request_id']})")
PHP
<?php
$ch = curl_init('https://api.posdata.so/public/v1/me');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('POSDATA_API_KEY'),
    ],
]);
$data = json_decode(curl_exec($ch), true);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 400) {
    throw new RuntimeException("{$data['error']['code']}: {$data['error']['message']} ({$data['error']['request_id']})");
}

Respuesta

200 OK: un objeto Account.

CampoTipoRequeridoDescripción
object"account"Sí—
idstring (uuid)SíId de la cuenta (tenant).
businessobject | nullSí—
business.namestringNo—
business.currencystringNo—
planstringSíValores: free, plus, plus_nofe, pro, pro_nofe.
api_keyobject | nullSí—
api_key.idstring (uuid)No—
api_key.namestringNo—
api_key.environmentstringNoValores: live, test.
api_key.scopesarreglo de ScopeNo—
api_key.expires_atstring (date-time) | nullNo—
data_freshnessobjectSíLa API lee lo que las cajas ya subieron. last_sync_at es el último cambio que cada caja subió de verdad (null si nunca subió nada): si una caja lleva horas sin subir, sus ventas recientes todavía no aparecen.
data_freshness.last_device_sync_atstring (date-time) | nullNo—
data_freshness.devicesarreglo de objectNo—
data_freshness.devices[].namestring | nullNo—
data_freshness.devices[].kindstringNoValores: primary, satellite, kitchen.
data_freshness.devices[].platformstring | nullNo—
data_freshness.devices[].last_sync_atstring (date-time) | nullNo—
Ejemplo de respuesta (valores ilustrativos)
{
  "object": "account",
  "id": "3f1c2e8d-7a10-4d0b-9a57-0b6f2f0e5c1d",
  "business": {
    "name": "Café molido 500 g",
    "currency": "COP"
  },
  "plan": "free",
  "api_key": {
    "id": "3f1c2e8d-7a10-4d0b-9a57-0b6f2f0e5c1d",
    "name": "Café molido 500 g",
    "environment": "live",
    "scopes": [
      "products:read"
    ],
    "expires_at": "2026-09-28T15:04:05.000Z"
  },
  "data_freshness": {
    "last_device_sync_at": "2026-09-28T15:04:05.000Z",
    "devices": [
      {
        "name": "Café molido 500 g",
        "kind": "primary",
        "platform": "texto",
        "last_sync_at": "2026-09-28T15:04:05.000Z"
      }
    ]
  }
}

Errores

Todo error responde con un objeto Error y un request_id. Ramifica por error.code, nunca por el mensaje.

Cuerpo: un objeto Error. Qué significa cada código y qué hacer: Errores.

VALIDATION_ERRORINVALID_JSONINVALID_CURSOR

Cuerpo: un objeto Error. Qué significa cada código y qué hacer: Errores.

UNAUTHENTICATEDINVALID_API_KEYAPI_KEY_REVOKEDAPI_KEY_EXPIREDAPI_KEY_WRONG_ENVIRONMENTACCOUNT_INACTIVE

Cuerpo: un objeto Error. Qué significa cada código y qué hacer: Errores.

PLAN_REQUIREDINSUFFICIENT_SCOPEBROWSER_REQUESTS_NOT_ALLOWED

Cuerpo: un objeto Error. Qué significa cada código y qué hacer: Errores.

RATE_LIMITED

Cuerpo: un objeto Error. Qué significa cada código y qué hacer: Errores.

INTERNAL_ERROR