Skip to main content

Documentation Index

Fetch the complete documentation index at: https://developers.tarefy.com/llms.txt

Use this file to discover all available pages before exploring further.

Convenções

A API usa status codes HTTP padrão. Corpo da resposta é JSON com message e opcionalmente code / errors:
{
  "message": "Validation failed",
  "errors": {
    "email": "Email inválido",
    "password": "Mínimo 8 caracteres"
  }
}

Códigos mais comuns

StatusQuando ocorre
200Sucesso
201Recurso criado
204Sucesso sem conteúdo (ex: delete)
400Bad request — payload malformado ou dados inválidos
401Não autenticado (token ausente, inválido ou expirado)
402Pagamento necessário — assinatura vencida
403Sem permissão pra esse endpoint
404Recurso não encontrado
422Validação falhou — corpo tem errors por campo
429Rate limit — desacelere
500Erro interno — tente de novo; se persistir avise o suporte

Tratamento recomendado

async function callApi(path, options) {
  const res = await fetch(`https://app.tarefy.com/nodeapi${path}`, options);

  if (res.status === 401) {
    // token expirou → renova e tenta de novo
    await refreshToken();
    return callApi(path, options);
  }

  if (res.status === 402) {
    throw new Error('Assinatura vencida — verifique billing');
  }

  if (!res.ok) {
    const body = await res.json();
    throw new Error(body.message || `HTTP ${res.status}`);
  }

  return res.json();
}