Pular para o conteúdo
ZYRAQ / DOCS

Início Rápido

Comece a usar a API Zyraq em 5 minutos

Início Rápido

Este guia mostra como fazer sua primeira integração com a API Zyraq. Ao final, você terá criado um cliente e um veículo via API.

Pré-requisitos

  • Conta ativa na Zyraq
  • API Key gerada (veja Autenticação)
  • store_id da sua loja (em Configurações → Lojas no painel)

Obtenha sua API Key e o ID da Loja

  1. Acesse o painel da Zyraq
  2. Navegue até ConfiguraçõesAPI Keys
  3. Clique em Criar Nova Chave
  4. Copie sua chave (formato: ea_live_...)

Para obter o store_id, vá em Configurações → Lojas e copie o ID da loja desejada.

Guarde sua API Key em segurança. Ela não será exibida novamente!

Crie seu primeiro cliente

Crie um cliente Pessoa Física:

curl -X POST https://app.zyraqgroup.com/api/v1/clients \
  -H "Authorization: Bearer ea_live_sua_chave_aqui" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "PF",
    "name": "João da Silva",
    "email": "joao.silva@email.com",
    "cpf": "123.456.789-00",
    "phone": "+55 11 99999-8888",
    "segment": "premium"
  }'

Resposta:

{
  "success": true,
  "data": {
    "id": "uuid-do-cliente",
    "type": "PF",
    "name": "João da Silva",
    "email": "joao.silva@email.com",
    "cpf": "123.456.789-00",
    "phone": "+55 11 99999-8888",
    "segment": "premium",
    "status": "active",
    "created_at": "2026-02-04T10:30:00Z"
  }
}

Cadastre um veículo

Agora cadastre um veículo no inventário. O campo store_id é obrigatório:

curl -X POST https://app.zyraqgroup.com/api/v1/vehicles \
  -H "Authorization: Bearer ea_live_sua_chave_aqui" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Honda Civic EXL 2.0 2024",
    "store_id": "uuid-da-sua-loja",
    "brand": "Honda",
    "model": "Civic",
    "version": "EXL 2.0 Flex",
    "year_model": 2024,
    "year_manufacture": 2023,
    "price": 142900.00,
    "purchase_price": 125000.00,
    "mileage": 18500,
    "color": "Preto",
    "fuel": "flex",
    "transmission": "automatico",
    "plate": "ABC1D23",
    "client_id": "uuid-do-cliente"
  }'

Resposta:

{
  "success": true,
  "data": {
    "id": "uuid-do-veiculo",
    "title": "Honda Civic EXL 2.0 2024",
    "brand": "Honda",
    "model": "Civic",
    "version": "EXL 2.0 Flex",
    "year_model": 2024,
    "price": 142900.0,
    "purchase_price": 125000.0,
    "mileage": 18500,
    "color": "Preto",
    "fuel": "flex",
    "transmission": "automatico",
    "plate": "ABC1D23",
    "phase": "entrada",
    "status": "ativo",
    "store_id": "uuid-da-sua-loja",
    "client_id": "uuid-do-cliente",
    "created_at": "2026-02-04T10:31:00Z"
  }
}

Crie um negócio (deal)

Registre um negócio vinculando o cliente ao veículo:

curl -X POST https://app.zyraqgroup.com/api/v1/deals \
  -H "Authorization: Bearer ea_live_sua_chave_aqui" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Venda Honda Civic 2024 — João da Silva",
    "value": 142900.00,
    "phase": "lead",
    "probability": 40,
    "client_id": "uuid-do-cliente",
    "source": "showroom",
    "tags": ["civic", "premium"]
  }'

Resposta:

{
  "success": true,
  "data": {
    "id": "uuid-do-negocio",
    "title": "Venda Honda Civic 2024 — João da Silva",
    "value": 142900.0,
    "phase": "lead",
    "probability": 40,
    "status": "ativo",
    "client_id": "uuid-do-cliente",
    "created_at": "2026-02-04T10:32:00Z"
  }
}

Liste seus veículos

Verifique os veículos cadastrados:

curl -X GET "https://app.zyraqgroup.com/api/v1/vehicles?status=ativo" \
  -H "Authorization: Bearer ea_live_sua_chave_aqui"

Resposta:

{
  "success": true,
  "data": [
    {
      "id": "uuid-do-veiculo",
      "title": "Honda Civic EXL 2.0 2024",
      "brand": "Honda",
      "model": "Civic",
      "year_model": 2024,
      "price": 142900.0,
      "mileage": 18500,
      "color": "Preto",
      "status": "ativo",
      "phase": "entrada",
      "client": {
        "id": "uuid-do-cliente",
        "name": "João da Silva"
      }
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 1,
    "pages": 1
  }
}

Próximos Passos

Agora que você fez sua primeira integração, explore mais recursos:

  • Veículos — Documentação completa do inventário (campos FIPE, carroceria, etc.)
  • Clientes — Gerenciar clientes PF e PJ com endereço e segmentação
  • Negócios — Pipeline de vendas e como marcar ganho/perdido

Exemplo Completo em JavaScript

// zyraq-client.js
class ZyraqClient {
  constructor(apiKey) {
    this.apiKey = apiKey;
    this.baseUrl = 'https://app.zyraqgroup.com/api/v1';
  }

  async request(endpoint, options = {}) {
    const response = await fetch(`${this.baseUrl}${endpoint}`, {
      ...options,
      headers: {
        Authorization: `Bearer ${this.apiKey}`,
        'Content-Type': 'application/json',
        ...options.headers,
      },
    });

    if (!response.ok) {
      const error = await response.json();
      throw new Error(error.error?.message || 'Erro na requisição');
    }

    return response.json();
  }

  // Clientes
  async createClient(data) {
    return this.request('/clients', {
      method: 'POST',
      body: JSON.stringify(data),
    });
  }

  async getClients(params = {}) {
    const query = new URLSearchParams(params).toString();
    return this.request(`/clients?${query}`);
  }

  // Veículos
  async createVehicle(data) {
    return this.request('/vehicles', {
      method: 'POST',
      body: JSON.stringify(data),
    });
  }

  async getVehicles(params = {}) {
    const query = new URLSearchParams(params).toString();
    return this.request(`/vehicles?${query}`);
  }

  async updateVehicle(id, data) {
    return this.request(`/vehicles/${id}`, {
      method: 'PUT',
      body: JSON.stringify(data),
    });
  }

  // Negócios
  async createDeal(data) {
    return this.request('/deals', {
      method: 'POST',
      body: JSON.stringify(data),
    });
  }

  async markDealWon(id, finalValue) {
    return this.request(`/deals/${id}`, {
      method: 'PUT',
      body: JSON.stringify({ status: 'ganho', value: finalValue }),
    });
  }

  async markDealLost(id, lossReason) {
    return this.request(`/deals/${id}`, {
      method: 'PUT',
      body: JSON.stringify({ status: 'perdido', loss_reason: lossReason }),
    });
  }
}

// Uso
const client = new ZyraqClient(process.env.ZYRAQ_API_KEY);
const STORE_ID = process.env.ZYRAQ_STORE_ID;

async function cadastrarVeiculoCompleto(dadosCliente, dadosVeiculo) {
  const cliente = await client.createClient(dadosCliente);

  const veiculo = await client.createVehicle({
    ...dadosVeiculo,
    store_id: STORE_ID,
    client_id: cliente.data.id,
  });

  return { cliente: cliente.data, veiculo: veiculo.data };
}

// Exemplo
cadastrarVeiculoCompleto(
  {
    type: 'PF',
    name: 'Maria Santos',
    email: 'maria@email.com',
    cpf: '987.654.321-00',
  },
  {
    title: 'Toyota Corolla XEi 2.0 2025',
    brand: 'Toyota',
    model: 'Corolla',
    version: 'XEi 2.0 Flex',
    year_model: 2025,
    price: 165000.0,
    mileage: 0,
  }
).then(console.log);

Precisa de Ajuda?