Pular para o conteúdo
gensAPI

Referência das rotas

Encontre a operação, confira a permissão e abra os exemplos. Escritas alteram dados reais; prepare a chave de idempotência antes de executar.

Conta 3

GET/v1/accountaccount:readgetAccount

Requer `account:read`. A conta é sempre derivada da API Key.

Sem parâmetros além da autenticação.

curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/account" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/account" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/account",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
PATCH/v1/accountaccount:writeupdateAccount

Requer `account:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "nome": "Maria Souza",
  "email": "maria@exemplo.com"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X PATCH "https://api.crm.agenciagens.com.br/v1/account" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "nome": "Maria Souza",
  "email": "maria@exemplo.com"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "nome": "Maria Souza",
  "email": "maria@exemplo.com"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method PATCH -Uri "https://api.crm.agenciagens.com.br/v1/account" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "nome": "Maria Souza",
  "email": "maria@exemplo.com"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/account",
  {
    method: "PATCH",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
GET/v1/subscriptionsubscription:readgetSubscription

Requer `subscription:read`. A conta é sempre derivada da API Key.

Sem parâmetros além da autenticação.

curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/subscription" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/subscription" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/subscription",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.

Usuários 5

GET/v1/usersusers:readlistUsers

Requer `users:read`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
limitqueryItens por página. Padrão 50; máximo 100.
cursorqueryCursor opaco devolvido em next_cursor. Não altere o valor.
curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/users?limit=50" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/users?limit=50" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/users?limit=50",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
POST/v1/users/invitationsusers:writeinviteUser

Requer `users:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "nome_completo": "Maria Souza",
  "email": "maria@exemplo.com"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X POST "https://api.crm.agenciagens.com.br/v1/users/invitations" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "nome_completo": "Maria Souza",
  "email": "maria@exemplo.com"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "nome_completo": "Maria Souza",
  "email": "maria@exemplo.com"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method POST -Uri "https://api.crm.agenciagens.com.br/v1/users/invitations" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "nome_completo": "Maria Souza",
  "email": "maria@exemplo.com"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/users/invitations",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
PATCH/v1/users/{user_id}users:writeupdateUser

Requer `users:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
user_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "nome_completo": "Maria Souza"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X PATCH "https://api.crm.agenciagens.com.br/v1/users/{user_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "nome_completo": "Maria Souza"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "nome_completo": "Maria Souza"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method PATCH -Uri "https://api.crm.agenciagens.com.br/v1/users/{user_id}" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "nome_completo": "Maria Souza"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/users/{user_id}",
  {
    method: "PATCH",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
POST/v1/users/{user_id}/deactivateusers:writedeactivateUser

Requer `users:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
user_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X POST "https://api.crm.agenciagens.com.br/v1/users/{user_id}/deactivate" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method POST -Uri "https://api.crm.agenciagens.com.br/v1/users/{user_id}/deactivate" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/users/{user_id}/deactivate",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
POST/v1/users/{user_id}/reactivateusers:writereactivateUser

Requer `users:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
user_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X POST "https://api.crm.agenciagens.com.br/v1/users/{user_id}/reactivate" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method POST -Uri "https://api.crm.agenciagens.com.br/v1/users/{user_id}/reactivate" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/users/{user_id}/reactivate",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.

Contatos 17

GET/v1/contactscontacts:readlistContacts

Requer `contacts:read`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
limitqueryItens por página. Padrão 50; máximo 100.
cursorqueryCursor opaco devolvido em next_cursor. Não altere o valor.
searchqueryBusca ampla por nome, telefone ou e-mail. Confira phone e todas as páginas antes de escolher um UUID pelo telefone.
stage_idqueryEtapa do Kanban.
adqueryReferência legada de anúncio.
curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/contacts?limit=50" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/contacts?limit=50" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/contacts?limit=50",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
POST/v1/contactscontacts:writecreateContact

Requer `contacts:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "name": "Maria Souza",
  "phone": "+5511999990000",
  "email": "maria@exemplo.com"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X POST "https://api.crm.agenciagens.com.br/v1/contacts" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "name": "Maria Souza",
  "phone": "+5511999990000",
  "email": "maria@exemplo.com"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "name": "Maria Souza",
  "phone": "+5511999990000",
  "email": "maria@exemplo.com"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method POST -Uri "https://api.crm.agenciagens.com.br/v1/contacts" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "name": "Maria Souza",
  "phone": "+5511999990000",
  "email": "maria@exemplo.com"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/contacts",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
GET/v1/contacts/{contact_id}contacts:readgetContact

Requer `contacts:read`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
contact_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
PATCH/v1/contacts/{contact_id}contacts:writeupdateContact

Requer `contacts:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
contact_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "name": "Maria Souza",
  "phone": "+5511999990000"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X PATCH "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "name": "Maria Souza",
  "phone": "+5511999990000"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "name": "Maria Souza",
  "phone": "+5511999990000"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method PATCH -Uri "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "name": "Maria Souza",
  "phone": "+5511999990000"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}",
  {
    method: "PATCH",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
DELETE/v1/contacts/{contact_id}contacts:deletedeleteContact

Requer `contacts:delete`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
contact_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X DELETE "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method DELETE -Uri "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}",
  {
    method: "DELETE",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
POST/v1/contacts/{contact_id}/movekanban:writemoveContact

Requer `kanban:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
contact_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "stage_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X POST "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/move" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "stage_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "stage_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method POST -Uri "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/move" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "stage_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/move",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
GET/v1/contacts/{contact_id}/salescontacts:readlistContactSales

Requer `contacts:read`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
contact_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
limitqueryItens por página. Padrão 50; máximo 100.
cursorqueryCursor opaco devolvido em next_cursor. Não altere o valor.
curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/sales?limit=50" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/sales?limit=50" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/sales?limit=50",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
GET/v1/contacts/{contact_id}/ad-attributionscontacts:readlistContactAdAttributions

Requer `contacts:read`. A conta é sempre derivada da API Key. Entradas registradas em ordem cronológica crescente, com paginação por cursor. received_at informa a entrada capturada; recorded_at informa a persistência; attributed_at usa a entrada ou a persistência como fallback. contact_created_at permite comparar a primeira evidência com a criação do contato. Preparado para publicação; disponibilidade depende da migration e da versão publicada das funções REST/MCP.

ParâmetroEmDescrição
contact_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
limitqueryItens por página. Padrão 50; máximo 100.
cursorqueryCursor opaco devolvido em next_cursor. Não altere o valor.
curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/ad-attributions?limit=50" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/ad-attributions?limit=50" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/ad-attributions?limit=50",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
POST/v1/contacts/{contact_id}/salescontacts:writecreateContactSale

Requer `contacts:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
contact_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "value": "150.00",
  "service_name": "Maria Souza"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X POST "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/sales" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "value": "150.00",
  "service_name": "Maria Souza"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "value": "150.00",
  "service_name": "Maria Souza"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method POST -Uri "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/sales" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "value": "150.00",
  "service_name": "Maria Souza"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/sales",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
GET/v1/contacts/{contact_id}/sales/{sale_id}contacts:readgetContactSale

Requer `contacts:read`. A conta é sempre derivada da API Key. Consulta uma venda ativa ou o snapshot cancelado. Use updated_at desta venda nas correções.

ParâmetroEmDescrição
contact_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
sale_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/sales/{sale_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/sales/{sale_id}" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/sales/{sale_id}",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
PATCH/v1/contacts/{contact_id}/sales/{sale_id}contacts:writeupdateContactSale

Requer `contacts:write`. A conta é sempre derivada da API Key. Corrige ao menos um campo da venda com expected_updated_at da venda e reason. Preserva ID e autoria da credencial; ajusta LTV pelo delta. Não cria outro Purchase.

ParâmetroEmDescrição
contact_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
sale_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "reason": "texto de exemplo",
  "value": "150.00"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X PATCH "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/sales/{sale_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "reason": "texto de exemplo",
  "value": "150.00"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "reason": "texto de exemplo",
  "value": "150.00"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method PATCH -Uri "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/sales/{sale_id}" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "reason": "texto de exemplo",
  "value": "150.00"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/sales/{sale_id}",
  {
    method: "PATCH",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
DELETE/v1/contacts/{contact_id}/sales/{sale_id}contacts:writecancelContactSale

Requer `contacts:write`. A conta é sempre derivada da API Key. Cancela a venda com versão e justificativa, guarda snapshot e retira do faturamento ativo. Não apaga o contato; eventos Meta já enviados permanecem intactos.

ParâmetroEmDescrição
contact_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
sale_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "reason": "texto de exemplo"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X DELETE "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/sales/{sale_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "reason": "texto de exemplo"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "reason": "texto de exemplo"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method DELETE -Uri "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/sales/{sale_id}" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "reason": "texto de exemplo"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/sales/{sale_id}",
  {
    method: "DELETE",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
POST/v1/contacts/{contact_id}/follow-up/pausecontacts:writepauseContactFollowUp

Requer `contacts:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
contact_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X POST "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/follow-up/pause" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method POST -Uri "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/follow-up/pause" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/follow-up/pause",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
POST/v1/contacts/{contact_id}/follow-up/resumecontacts:writeresumeContactFollowUp

Requer `contacts:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
contact_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X POST "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/follow-up/resume" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method POST -Uri "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/follow-up/resume" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/follow-up/resume",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
PUT/v1/contacts/{contact_id}/tagstags:writereplaceContactTags

Requer `tags:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
contact_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "tag_ids": [
    "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d"
  ]
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X PUT "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/tags" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "tag_ids": [
    "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d"
  ]
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "tag_ids": [
    "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d"
  ]
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method PUT -Uri "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/tags" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "tag_ids": [
    "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d"
  ]
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/tags",
  {
    method: "PUT",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
PUT/v1/contacts/{contact_id}/tags/{tag_id}tags:writeaddContactTag

Requer `tags:write`. A conta é sempre derivada da API Key. Adiciona somente a tag indicada, com corpo {}. Preserva outras tags e não duplica vínculos.

ParâmetroEmDescrição
contact_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
tag_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X PUT "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/tags/{tag_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method PUT -Uri "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/tags/{tag_id}" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/tags/{tag_id}",
  {
    method: "PUT",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
DELETE/v1/contacts/{contact_id}/tags/{tag_id}tags:writeremoveContactTag

Requer `tags:write`. A conta é sempre derivada da API Key. Remove somente o vínculo da tag indicada, com corpo {}. Preserva outras tags e a própria tag global.

ParâmetroEmDescrição
contact_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
tag_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X DELETE "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/tags/{tag_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method DELETE -Uri "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/tags/{tag_id}" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/contacts/{contact_id}/tags/{tag_id}",
  {
    method: "DELETE",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.

Kanban 5

GET/v1/kanban/stageskanban:readlistKanbanStages

Requer `kanban:read`. A conta é sempre derivada da API Key.

Sem parâmetros além da autenticação.

curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/kanban/stages" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/kanban/stages" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/kanban/stages",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
POST/v1/kanban/stageskanban:writecreateKanbanStage

Requer `kanban:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "name": "Maria Souza",
  "color": "texto de exemplo"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X POST "https://api.crm.agenciagens.com.br/v1/kanban/stages" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "name": "Maria Souza",
  "color": "texto de exemplo"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "name": "Maria Souza",
  "color": "texto de exemplo"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method POST -Uri "https://api.crm.agenciagens.com.br/v1/kanban/stages" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "name": "Maria Souza",
  "color": "texto de exemplo"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/kanban/stages",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
PATCH/v1/kanban/stages/{stage_id}kanban:writeupdateKanbanStage

Requer `kanban:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
stage_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "name": "Maria Souza",
  "color": "texto de exemplo"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X PATCH "https://api.crm.agenciagens.com.br/v1/kanban/stages/{stage_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "name": "Maria Souza",
  "color": "texto de exemplo"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "name": "Maria Souza",
  "color": "texto de exemplo"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method PATCH -Uri "https://api.crm.agenciagens.com.br/v1/kanban/stages/{stage_id}" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "name": "Maria Souza",
  "color": "texto de exemplo"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/kanban/stages/{stage_id}",
  {
    method: "PATCH",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
PUT/v1/kanban/stages/orderkanban:writereorderKanbanStages

Requer `kanban:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "stage_ids": [
    "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d"
  ]
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X PUT "https://api.crm.agenciagens.com.br/v1/kanban/stages/order" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "stage_ids": [
    "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d"
  ]
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "stage_ids": [
    "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d"
  ]
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method PUT -Uri "https://api.crm.agenciagens.com.br/v1/kanban/stages/order" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "stage_ids": [
    "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d"
  ]
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/kanban/stages/order",
  {
    method: "PUT",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
DELETE/v1/kanban/stages/{stage_id}kanban:writedeleteKanbanStage

Requer `kanban:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
stage_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "move_contacts_to_stage_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X DELETE "https://api.crm.agenciagens.com.br/v1/kanban/stages/{stage_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "move_contacts_to_stage_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "move_contacts_to_stage_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method DELETE -Uri "https://api.crm.agenciagens.com.br/v1/kanban/stages/{stage_id}" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "move_contacts_to_stage_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/kanban/stages/{stage_id}",
  {
    method: "DELETE",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.

Follow-up 13

GET/v1/follow-ups/campaignsfollowups:readlistFollowUpCampaigns

Requer `followups:read`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
limitqueryItens por página. Padrão 50; máximo 100.
cursorqueryCursor opaco devolvido em next_cursor. Não altere o valor.
curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns?limit=50" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns?limit=50" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns?limit=50",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
POST/v1/follow-ups/campaignsfollowups:writecreateFollowUpCampaign

Requer `followups:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "name": "Maria Souza",
  "description": "texto de exemplo",
  "type": "automatico",
  "trigger_type": "inatividade_geral",
  "trigger_pattern": "texto de exemplo",
  "match_type": "contains",
  "inactivity_minutes": 0,
  "maximum_inactivity_minutes": 0,
  "send_time": "texto de exemplo",
  "send_deadline": "texto de exemplo",
  "send_mode": "horario_fixo",
  "business_days_only": true,
  "timezone": "texto de exemplo",
  "auto_pause_on_reply": true,
  "ad_contacts_only": true,
  "ad_name_filter": "Maria Souza",
  "custom_link_contacts_only": true,
  "stage_filter_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d",
  "relaunch_cooldown_days": 0,
  "daily_limit": 1,
  "smart_classification": true,
  "no_follow_up_phrases": [
    "texto de exemplo"
  ],
  "uses_ai": true,
  "ai_base_prompt": "texto de exemplo",
  "templates": [
    {
      "title": "texto de exemplo",
      "content": "texto de exemplo",
      "sequence": 1,
      "delay_minutes": 0
    }
  ]
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X POST "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "name": "Maria Souza",
  "description": "texto de exemplo",
  "type": "automatico",
  "trigger_type": "inatividade_geral",
  "trigger_pattern": "texto de exemplo",
  "match_type": "contains",
  "inactivity_minutes": 0,
  "maximum_inactivity_minutes": 0,
  "send_time": "texto de exemplo",
  "send_deadline": "texto de exemplo",
  "send_mode": "horario_fixo",
  "business_days_only": true,
  "timezone": "texto de exemplo",
  "auto_pause_on_reply": true,
  "ad_contacts_only": true,
  "ad_name_filter": "Maria Souza",
  "custom_link_contacts_only": true,
  "stage_filter_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d",
  "relaunch_cooldown_days": 0,
  "daily_limit": 1,
  "smart_classification": true,
  "no_follow_up_phrases": [
    "texto de exemplo"
  ],
  "uses_ai": true,
  "ai_base_prompt": "texto de exemplo",
  "templates": [
    {
      "title": "texto de exemplo",
      "content": "texto de exemplo",
      "sequence": 1,
      "delay_minutes": 0
    }
  ]
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "name": "Maria Souza",
  "description": "texto de exemplo",
  "type": "automatico",
  "trigger_type": "inatividade_geral",
  "trigger_pattern": "texto de exemplo",
  "match_type": "contains",
  "inactivity_minutes": 0,
  "maximum_inactivity_minutes": 0,
  "send_time": "texto de exemplo",
  "send_deadline": "texto de exemplo",
  "send_mode": "horario_fixo",
  "business_days_only": true,
  "timezone": "texto de exemplo",
  "auto_pause_on_reply": true,
  "ad_contacts_only": true,
  "ad_name_filter": "Maria Souza",
  "custom_link_contacts_only": true,
  "stage_filter_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d",
  "relaunch_cooldown_days": 0,
  "daily_limit": 1,
  "smart_classification": true,
  "no_follow_up_phrases": [
    "texto de exemplo"
  ],
  "uses_ai": true,
  "ai_base_prompt": "texto de exemplo",
  "templates": [
    {
      "title": "texto de exemplo",
      "content": "texto de exemplo",
      "sequence": 1,
      "delay_minutes": 0
    }
  ]
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method POST -Uri "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "name": "Maria Souza",
  "description": "texto de exemplo",
  "type": "automatico",
  "trigger_type": "inatividade_geral",
  "trigger_pattern": "texto de exemplo",
  "match_type": "contains",
  "inactivity_minutes": 0,
  "maximum_inactivity_minutes": 0,
  "send_time": "texto de exemplo",
  "send_deadline": "texto de exemplo",
  "send_mode": "horario_fixo",
  "business_days_only": true,
  "timezone": "texto de exemplo",
  "auto_pause_on_reply": true,
  "ad_contacts_only": true,
  "ad_name_filter": "Maria Souza",
  "custom_link_contacts_only": true,
  "stage_filter_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d",
  "relaunch_cooldown_days": 0,
  "daily_limit": 1,
  "smart_classification": true,
  "no_follow_up_phrases": [
    "texto de exemplo"
  ],
  "uses_ai": true,
  "ai_base_prompt": "texto de exemplo",
  "templates": [
    {
      "title": "texto de exemplo",
      "content": "texto de exemplo",
      "sequence": 1,
      "delay_minutes": 0
    }
  ]
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
GET/v1/follow-ups/campaigns/{campaign_id}followups:readgetFollowUpCampaign

Requer `followups:read`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
campaign_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns/{campaign_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns/{campaign_id}" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns/{campaign_id}",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
PATCH/v1/follow-ups/campaigns/{campaign_id}followups:writeupdateFollowUpCampaign

Requer `followups:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
campaign_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "name": "Maria Souza",
  "description": "texto de exemplo",
  "type": "automatico",
  "trigger_type": "inatividade_geral",
  "trigger_pattern": "texto de exemplo",
  "match_type": "contains",
  "inactivity_minutes": 0,
  "maximum_inactivity_minutes": 0,
  "send_time": "texto de exemplo",
  "send_deadline": "texto de exemplo",
  "send_mode": "horario_fixo",
  "business_days_only": true,
  "timezone": "texto de exemplo",
  "auto_pause_on_reply": true,
  "ad_contacts_only": true,
  "ad_name_filter": "Maria Souza",
  "custom_link_contacts_only": true,
  "stage_filter_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d",
  "relaunch_cooldown_days": 0,
  "daily_limit": 1,
  "smart_classification": true,
  "no_follow_up_phrases": [
    "texto de exemplo"
  ],
  "uses_ai": true,
  "ai_base_prompt": "texto de exemplo",
  "templates": [
    {
      "title": "texto de exemplo",
      "content": "texto de exemplo",
      "sequence": 1,
      "delay_minutes": 0
    }
  ]
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X PATCH "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns/{campaign_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "name": "Maria Souza",
  "description": "texto de exemplo",
  "type": "automatico",
  "trigger_type": "inatividade_geral",
  "trigger_pattern": "texto de exemplo",
  "match_type": "contains",
  "inactivity_minutes": 0,
  "maximum_inactivity_minutes": 0,
  "send_time": "texto de exemplo",
  "send_deadline": "texto de exemplo",
  "send_mode": "horario_fixo",
  "business_days_only": true,
  "timezone": "texto de exemplo",
  "auto_pause_on_reply": true,
  "ad_contacts_only": true,
  "ad_name_filter": "Maria Souza",
  "custom_link_contacts_only": true,
  "stage_filter_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d",
  "relaunch_cooldown_days": 0,
  "daily_limit": 1,
  "smart_classification": true,
  "no_follow_up_phrases": [
    "texto de exemplo"
  ],
  "uses_ai": true,
  "ai_base_prompt": "texto de exemplo",
  "templates": [
    {
      "title": "texto de exemplo",
      "content": "texto de exemplo",
      "sequence": 1,
      "delay_minutes": 0
    }
  ]
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "name": "Maria Souza",
  "description": "texto de exemplo",
  "type": "automatico",
  "trigger_type": "inatividade_geral",
  "trigger_pattern": "texto de exemplo",
  "match_type": "contains",
  "inactivity_minutes": 0,
  "maximum_inactivity_minutes": 0,
  "send_time": "texto de exemplo",
  "send_deadline": "texto de exemplo",
  "send_mode": "horario_fixo",
  "business_days_only": true,
  "timezone": "texto de exemplo",
  "auto_pause_on_reply": true,
  "ad_contacts_only": true,
  "ad_name_filter": "Maria Souza",
  "custom_link_contacts_only": true,
  "stage_filter_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d",
  "relaunch_cooldown_days": 0,
  "daily_limit": 1,
  "smart_classification": true,
  "no_follow_up_phrases": [
    "texto de exemplo"
  ],
  "uses_ai": true,
  "ai_base_prompt": "texto de exemplo",
  "templates": [
    {
      "title": "texto de exemplo",
      "content": "texto de exemplo",
      "sequence": 1,
      "delay_minutes": 0
    }
  ]
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method PATCH -Uri "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns/{campaign_id}" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "name": "Maria Souza",
  "description": "texto de exemplo",
  "type": "automatico",
  "trigger_type": "inatividade_geral",
  "trigger_pattern": "texto de exemplo",
  "match_type": "contains",
  "inactivity_minutes": 0,
  "maximum_inactivity_minutes": 0,
  "send_time": "texto de exemplo",
  "send_deadline": "texto de exemplo",
  "send_mode": "horario_fixo",
  "business_days_only": true,
  "timezone": "texto de exemplo",
  "auto_pause_on_reply": true,
  "ad_contacts_only": true,
  "ad_name_filter": "Maria Souza",
  "custom_link_contacts_only": true,
  "stage_filter_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d",
  "relaunch_cooldown_days": 0,
  "daily_limit": 1,
  "smart_classification": true,
  "no_follow_up_phrases": [
    "texto de exemplo"
  ],
  "uses_ai": true,
  "ai_base_prompt": "texto de exemplo",
  "templates": [
    {
      "title": "texto de exemplo",
      "content": "texto de exemplo",
      "sequence": 1,
      "delay_minutes": 0
    }
  ]
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns/{campaign_id}",
  {
    method: "PATCH",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
POST/v1/follow-ups/campaigns/{campaign_id}/archivefollowups:writearchiveFollowUpCampaign

Requer `followups:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
campaign_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X POST "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns/{campaign_id}/archive" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method POST -Uri "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns/{campaign_id}/archive" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns/{campaign_id}/archive",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
POST/v1/follow-ups/campaigns/{campaign_id}/activatefollowups:executeactivateFollowUpCampaign

Requer `followups:execute`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
campaign_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X POST "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns/{campaign_id}/activate" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method POST -Uri "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns/{campaign_id}/activate" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns/{campaign_id}/activate",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
POST/v1/follow-ups/campaigns/{campaign_id}/pausefollowups:executepauseFollowUpCampaign

Requer `followups:execute`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
campaign_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X POST "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns/{campaign_id}/pause" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method POST -Uri "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns/{campaign_id}/pause" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns/{campaign_id}/pause",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
GET/v1/follow-ups/campaigns/{campaign_id}/templatesfollowups:readlistFollowUpTemplates

Requer `followups:read`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
campaign_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns/{campaign_id}/templates" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns/{campaign_id}/templates" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns/{campaign_id}/templates",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
POST/v1/follow-ups/campaigns/{campaign_id}/templatesfollowups:writecreateFollowUpTemplate

Requer `followups:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
campaign_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "title": "texto de exemplo",
  "content": "texto de exemplo",
  "sequence": 1,
  "delay_minutes": 0
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X POST "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns/{campaign_id}/templates" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "title": "texto de exemplo",
  "content": "texto de exemplo",
  "sequence": 1,
  "delay_minutes": 0
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "title": "texto de exemplo",
  "content": "texto de exemplo",
  "sequence": 1,
  "delay_minutes": 0
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method POST -Uri "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns/{campaign_id}/templates" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "title": "texto de exemplo",
  "content": "texto de exemplo",
  "sequence": 1,
  "delay_minutes": 0
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/follow-ups/campaigns/{campaign_id}/templates",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
PATCH/v1/follow-ups/templates/{template_id}followups:writeupdateFollowUpTemplate

Requer `followups:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
template_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "title": "texto de exemplo",
  "content": "texto de exemplo",
  "sequence": 1,
  "delay_minutes": 0
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X PATCH "https://api.crm.agenciagens.com.br/v1/follow-ups/templates/{template_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "title": "texto de exemplo",
  "content": "texto de exemplo",
  "sequence": 1,
  "delay_minutes": 0
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "title": "texto de exemplo",
  "content": "texto de exemplo",
  "sequence": 1,
  "delay_minutes": 0
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method PATCH -Uri "https://api.crm.agenciagens.com.br/v1/follow-ups/templates/{template_id}" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "title": "texto de exemplo",
  "content": "texto de exemplo",
  "sequence": 1,
  "delay_minutes": 0
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/follow-ups/templates/{template_id}",
  {
    method: "PATCH",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
POST/v1/follow-ups/templates/{template_id}/archivefollowups:writearchiveFollowUpTemplate

Requer `followups:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
template_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X POST "https://api.crm.agenciagens.com.br/v1/follow-ups/templates/{template_id}/archive" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method POST -Uri "https://api.crm.agenciagens.com.br/v1/follow-ups/templates/{template_id}/archive" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/follow-ups/templates/{template_id}/archive",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
GET/v1/follow-ups/executionsfollowups:readlistFollowUpExecutions

Requer `followups:read`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
limitqueryItens por página. Padrão 50; máximo 100.
cursorqueryCursor opaco devolvido em next_cursor. Não altere o valor.
campaign_idqueryCampanha.
contact_idqueryContato.
statusqueryStatus da execução.
curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/follow-ups/executions?limit=50" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/follow-ups/executions?limit=50" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/follow-ups/executions?limit=50",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
GET/v1/follow-ups/metricsfollowups:readgetFollowUpMetrics

Requer `followups:read`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
campaign_idqueryCampanha opcional.
curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/follow-ups/metrics" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/follow-ups/metrics" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/follow-ups/metrics",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.

Retornos 10

GET/v1/returnsreturns:readlistReturns

Requer `returns:read`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
limitqueryMáximo de itens desta consulta. A lista não garante exportação completa.
cursorqueryCorte temporal exclusivo em ISO 8601; não garante continuidade para horários iguais.
fromqueryInício inclusivo do período em ISO 8601.
toqueryFim inclusivo do período em ISO 8601.
statusqueryEstado atual do retorno.
executor_typequeryResponsável pela execução.
curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/returns?limit=25" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/returns?limit=25" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/returns?limit=25",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
POST/v1/returnsreturns:writecreateReturn

Requer `returns:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "contact_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d",
  "scheduled_for": "2026-08-22T12:00:00Z",
  "reason": "texto de exemplo",
  "context_note": "Texto de exemplo",
  "executor_type": "human",
  "execution_mode": "draft_only"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X POST "https://api.crm.agenciagens.com.br/v1/returns" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "contact_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d",
  "scheduled_for": "2026-08-22T12:00:00Z",
  "reason": "texto de exemplo",
  "context_note": "Texto de exemplo",
  "executor_type": "human",
  "execution_mode": "draft_only"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "contact_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d",
  "scheduled_for": "2026-08-22T12:00:00Z",
  "reason": "texto de exemplo",
  "context_note": "Texto de exemplo",
  "executor_type": "human",
  "execution_mode": "draft_only"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method POST -Uri "https://api.crm.agenciagens.com.br/v1/returns" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "contact_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d",
  "scheduled_for": "2026-08-22T12:00:00Z",
  "reason": "texto de exemplo",
  "context_note": "Texto de exemplo",
  "executor_type": "human",
  "execution_mode": "draft_only"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/returns",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
GET/v1/returns/{return_id}returns:readgetReturn

Requer `returns:read`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
return_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/returns/{return_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/returns/{return_id}" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/returns/{return_id}",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
PATCH/v1/returns/{return_id}returns:writeupdateReturn

Requer `returns:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
return_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "scheduled_for": "2026-08-22T12:00:00Z",
  "reason": "texto de exemplo"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X PATCH "https://api.crm.agenciagens.com.br/v1/returns/{return_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "scheduled_for": "2026-08-22T12:00:00Z",
  "reason": "texto de exemplo"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "scheduled_for": "2026-08-22T12:00:00Z",
  "reason": "texto de exemplo"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method PATCH -Uri "https://api.crm.agenciagens.com.br/v1/returns/{return_id}" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "scheduled_for": "2026-08-22T12:00:00Z",
  "reason": "texto de exemplo"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/returns/{return_id}",
  {
    method: "PATCH",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
DELETE/v1/returns/{return_id}returns:writedeleteReturn

Requer `returns:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
return_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X DELETE "https://api.crm.agenciagens.com.br/v1/returns/{return_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method DELETE -Uri "https://api.crm.agenciagens.com.br/v1/returns/{return_id}" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/returns/{return_id}",
  {
    method: "DELETE",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
POST/v1/returns/{return_id}/claimreturns:executeclaimReturn

Requer `returns:execute`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
return_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X POST "https://api.crm.agenciagens.com.br/v1/returns/{return_id}/claim" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method POST -Uri "https://api.crm.agenciagens.com.br/v1/returns/{return_id}/claim" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/returns/{return_id}/claim",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
GET/v1/returns/{return_id}/contextreturns:executegetReturnContext

Requer `returns:execute`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
return_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/returns/{return_id}/context" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/returns/{return_id}/context" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/returns/{return_id}/context",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
POST/v1/returns/{return_id}/outcomereturns:executesubmitReturnOutcome

Requer `returns:execute`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
return_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "outcome": "draft_ready",
  "message": "texto de exemplo"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X POST "https://api.crm.agenciagens.com.br/v1/returns/{return_id}/outcome" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "outcome": "draft_ready",
  "message": "texto de exemplo"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "outcome": "draft_ready",
  "message": "texto de exemplo"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method POST -Uri "https://api.crm.agenciagens.com.br/v1/returns/{return_id}/outcome" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "outcome": "draft_ready",
  "message": "texto de exemplo"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/returns/{return_id}/outcome",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
POST/v1/returns/{return_id}/reschedulereturns:writerescheduleReturn

Requer `returns:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
return_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "scheduled_for": "2026-08-22T12:00:00Z"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X POST "https://api.crm.agenciagens.com.br/v1/returns/{return_id}/reschedule" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "scheduled_for": "2026-08-22T12:00:00Z"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "scheduled_for": "2026-08-22T12:00:00Z"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method POST -Uri "https://api.crm.agenciagens.com.br/v1/returns/{return_id}/reschedule" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "scheduled_for": "2026-08-22T12:00:00Z"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/returns/{return_id}/reschedule",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
POST/v1/returns/{return_id}/cancelreturns:writecancelReturn

Requer `returns:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
return_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X POST "https://api.crm.agenciagens.com.br/v1/returns/{return_id}/cancel" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method POST -Uri "https://api.crm.agenciagens.com.br/v1/returns/{return_id}/cancel" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/returns/{return_id}/cancel",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.

Anúncios 5

GET/v1/ads/contactsads:readlistAdContacts

Requer `ads:read`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
limitqueryItens por página. Padrão 50; máximo 100.
cursorqueryCursor opaco devolvido em next_cursor. Não altere o valor.
ad_referencequeryCorrespondência exata, sem diferenciar maiúsculas: referência histórica ou referência, URL, ID/nome validado do anúncio da atribuição mais recente.
created_fromqueryInício do período de criação do contato, não da atribuição.
created_toqueryFim do período de criação do contato, não da atribuição.
curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/ads/contacts?limit=50" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/ads/contacts?limit=50" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/ads/contacts?limit=50",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
GET/v1/ads/rulesads:readlistAdRules

Requer `ads:read`. A conta é sempre derivada da API Key.

Sem parâmetros além da autenticação.

curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/ads/rules" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/ads/rules" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/ads/rules",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
POST/v1/ads/rulesads:writecreateAdRule

Requer `ads:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "ad_name": "Maria Souza",
  "ad_phrase": "texto de exemplo",
  "ad_source": "indicacao"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X POST "https://api.crm.agenciagens.com.br/v1/ads/rules" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "ad_name": "Maria Souza",
  "ad_phrase": "texto de exemplo",
  "ad_source": "indicacao"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "ad_name": "Maria Souza",
  "ad_phrase": "texto de exemplo",
  "ad_source": "indicacao"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method POST -Uri "https://api.crm.agenciagens.com.br/v1/ads/rules" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "ad_name": "Maria Souza",
  "ad_phrase": "texto de exemplo",
  "ad_source": "indicacao"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/ads/rules",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
PATCH/v1/ads/rules/{rule_id}ads:writeupdateAdRule

Requer `ads:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
rule_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "ad_name": "Maria Souza",
  "ad_phrase": "texto de exemplo",
  "ad_source": "indicacao",
  "active": true
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X PATCH "https://api.crm.agenciagens.com.br/v1/ads/rules/{rule_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "ad_name": "Maria Souza",
  "ad_phrase": "texto de exemplo",
  "ad_source": "indicacao",
  "active": true
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "ad_name": "Maria Souza",
  "ad_phrase": "texto de exemplo",
  "ad_source": "indicacao",
  "active": true
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method PATCH -Uri "https://api.crm.agenciagens.com.br/v1/ads/rules/{rule_id}" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "ad_name": "Maria Souza",
  "ad_phrase": "texto de exemplo",
  "ad_source": "indicacao",
  "active": true
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/ads/rules/{rule_id}",
  {
    method: "PATCH",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
DELETE/v1/ads/rules/{rule_id}ads:writedeleteAdRule

Requer `ads:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
rule_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X DELETE "https://api.crm.agenciagens.com.br/v1/ads/rules/{rule_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method DELETE -Uri "https://api.crm.agenciagens.com.br/v1/ads/rules/{rule_id}" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/ads/rules/{rule_id}",
  {
    method: "DELETE",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
GET/v1/links/customlinks:readlistCustomLinks

Requer `links:read`. A conta é sempre derivada da API Key.

Sem parâmetros além da autenticação.

curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/links/custom" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/links/custom" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/links/custom",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
POST/v1/links/customlinks:writecreateCustomLink

Requer `links:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "link_name": "Maria Souza",
  "link_phrase": "https://exemplo.com.br",
  "link_source": "https://exemplo.com.br"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X POST "https://api.crm.agenciagens.com.br/v1/links/custom" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "link_name": "Maria Souza",
  "link_phrase": "https://exemplo.com.br",
  "link_source": "https://exemplo.com.br"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "link_name": "Maria Souza",
  "link_phrase": "https://exemplo.com.br",
  "link_source": "https://exemplo.com.br"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method POST -Uri "https://api.crm.agenciagens.com.br/v1/links/custom" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "link_name": "Maria Souza",
  "link_phrase": "https://exemplo.com.br",
  "link_source": "https://exemplo.com.br"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/links/custom",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
PATCH/v1/links/custom/{link_id}links:writeupdateCustomLink

Requer `links:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
link_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "link_name": "Maria Souza",
  "link_phrase": "https://exemplo.com.br",
  "link_source": "https://exemplo.com.br",
  "active": true
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X PATCH "https://api.crm.agenciagens.com.br/v1/links/custom/{link_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "link_name": "Maria Souza",
  "link_phrase": "https://exemplo.com.br",
  "link_source": "https://exemplo.com.br",
  "active": true
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "link_name": "Maria Souza",
  "link_phrase": "https://exemplo.com.br",
  "link_source": "https://exemplo.com.br",
  "active": true
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method PATCH -Uri "https://api.crm.agenciagens.com.br/v1/links/custom/{link_id}" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "link_name": "Maria Souza",
  "link_phrase": "https://exemplo.com.br",
  "link_source": "https://exemplo.com.br",
  "active": true
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/links/custom/{link_id}",
  {
    method: "PATCH",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
DELETE/v1/links/custom/{link_id}links:writedeleteCustomLink

Requer `links:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
link_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X DELETE "https://api.crm.agenciagens.com.br/v1/links/custom/{link_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method DELETE -Uri "https://api.crm.agenciagens.com.br/v1/links/custom/{link_id}" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/links/custom/{link_id}",
  {
    method: "DELETE",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
GET/v1/links/trackinglinks:readlistTrackingLinks

Requer `links:read`. A conta é sempre derivada da API Key.

Sem parâmetros além da autenticação.

curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/links/tracking" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/links/tracking" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/links/tracking",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
POST/v1/links/trackinglinks:writecreateTrackingLink

Requer `links:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "name": "Maria Souza",
  "slug": "texto de exemplo",
  "whatsapp_number": "+5511999990000",
  "default_message": "texto de exemplo",
  "default_source": "indicacao",
  "redirect_domain": "texto de exemplo",
  "attribution_window_days": 1,
  "capture_enabled": true,
  "utm_template": {},
  "initial_event_name": "Maria Souza"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X POST "https://api.crm.agenciagens.com.br/v1/links/tracking" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "name": "Maria Souza",
  "slug": "texto de exemplo",
  "whatsapp_number": "+5511999990000",
  "default_message": "texto de exemplo",
  "default_source": "indicacao",
  "redirect_domain": "texto de exemplo",
  "attribution_window_days": 1,
  "capture_enabled": true,
  "utm_template": {},
  "initial_event_name": "Maria Souza"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "name": "Maria Souza",
  "slug": "texto de exemplo",
  "whatsapp_number": "+5511999990000",
  "default_message": "texto de exemplo",
  "default_source": "indicacao",
  "redirect_domain": "texto de exemplo",
  "attribution_window_days": 1,
  "capture_enabled": true,
  "utm_template": {},
  "initial_event_name": "Maria Souza"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method POST -Uri "https://api.crm.agenciagens.com.br/v1/links/tracking" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "name": "Maria Souza",
  "slug": "texto de exemplo",
  "whatsapp_number": "+5511999990000",
  "default_message": "texto de exemplo",
  "default_source": "indicacao",
  "redirect_domain": "texto de exemplo",
  "attribution_window_days": 1,
  "capture_enabled": true,
  "utm_template": {},
  "initial_event_name": "Maria Souza"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/links/tracking",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
PATCH/v1/links/tracking/{link_id}links:writeupdateTrackingLink

Requer `links:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
link_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "name": "Maria Souza",
  "slug": "texto de exemplo",
  "whatsapp_number": "+5511999990000",
  "default_message": "texto de exemplo",
  "default_source": "indicacao",
  "redirect_domain": "texto de exemplo",
  "attribution_window_days": 1,
  "capture_enabled": true,
  "utm_template": {},
  "initial_event_name": "Maria Souza"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X PATCH "https://api.crm.agenciagens.com.br/v1/links/tracking/{link_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "name": "Maria Souza",
  "slug": "texto de exemplo",
  "whatsapp_number": "+5511999990000",
  "default_message": "texto de exemplo",
  "default_source": "indicacao",
  "redirect_domain": "texto de exemplo",
  "attribution_window_days": 1,
  "capture_enabled": true,
  "utm_template": {},
  "initial_event_name": "Maria Souza"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "name": "Maria Souza",
  "slug": "texto de exemplo",
  "whatsapp_number": "+5511999990000",
  "default_message": "texto de exemplo",
  "default_source": "indicacao",
  "redirect_domain": "texto de exemplo",
  "attribution_window_days": 1,
  "capture_enabled": true,
  "utm_template": {},
  "initial_event_name": "Maria Souza"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method PATCH -Uri "https://api.crm.agenciagens.com.br/v1/links/tracking/{link_id}" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "name": "Maria Souza",
  "slug": "texto de exemplo",
  "whatsapp_number": "+5511999990000",
  "default_message": "texto de exemplo",
  "default_source": "indicacao",
  "redirect_domain": "texto de exemplo",
  "attribution_window_days": 1,
  "capture_enabled": true,
  "utm_template": {},
  "initial_event_name": "Maria Souza"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/links/tracking/{link_id}",
  {
    method: "PATCH",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
DELETE/v1/links/tracking/{link_id}links:writedeleteTrackingLink

Requer `links:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
link_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X DELETE "https://api.crm.agenciagens.com.br/v1/links/tracking/{link_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method DELETE -Uri "https://api.crm.agenciagens.com.br/v1/links/tracking/{link_id}" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/links/tracking/{link_id}",
  {
    method: "DELETE",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
GET/v1/links/contactslinks:readlistLinkContacts

Requer `links:read`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
limitqueryItens por página. Padrão 50; máximo 100.
cursorqueryCursor opaco devolvido em next_cursor. Não altere o valor.
link_referencequeryReferência de link.
created_fromqueryInício UTC.
created_toqueryFim UTC.
curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/links/contacts?limit=50" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/links/contacts?limit=50" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/links/contacts?limit=50",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
GET/v1/links/metricslinks:readgetLinkMetrics

Requer `links:read`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
created_fromqueryInício UTC.
created_toqueryFim UTC.
curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/links/metrics" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/links/metrics" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/links/metrics",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.

Tags 4

GET/v1/tagstags:readlistTags

Requer `tags:read`. A conta é sempre derivada da API Key.

Sem parâmetros além da autenticação.

curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/tags" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/tags" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/tags",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
POST/v1/tagstags:writecreateTag

Requer `tags:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "name": "Maria Souza",
  "color": "texto de exemplo",
  "color_hex": "texto de exemplo"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X POST "https://api.crm.agenciagens.com.br/v1/tags" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "name": "Maria Souza",
  "color": "texto de exemplo",
  "color_hex": "texto de exemplo"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "name": "Maria Souza",
  "color": "texto de exemplo",
  "color_hex": "texto de exemplo"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method POST -Uri "https://api.crm.agenciagens.com.br/v1/tags" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "name": "Maria Souza",
  "color": "texto de exemplo",
  "color_hex": "texto de exemplo"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/tags",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
PATCH/v1/tags/{tag_id}tags:writeupdateTag

Requer `tags:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
tag_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "name": "Maria Souza",
  "color": "texto de exemplo"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X PATCH "https://api.crm.agenciagens.com.br/v1/tags/{tag_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "name": "Maria Souza",
  "color": "texto de exemplo"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "name": "Maria Souza",
  "color": "texto de exemplo"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method PATCH -Uri "https://api.crm.agenciagens.com.br/v1/tags/{tag_id}" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "name": "Maria Souza",
  "color": "texto de exemplo"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/tags/{tag_id}",
  {
    method: "PATCH",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
DELETE/v1/tags/{tag_id}tags:writedeleteTag

Requer `tags:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
tag_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "replacement_tag_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X DELETE "https://api.crm.agenciagens.com.br/v1/tags/{tag_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "replacement_tag_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "replacement_tag_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method DELETE -Uri "https://api.crm.agenciagens.com.br/v1/tags/{tag_id}" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "replacement_tag_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/tags/{tag_id}",
  {
    method: "DELETE",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.

Serviços 4

GET/v1/servicesservices:readlistServices

Requer `services:read`. A conta é sempre derivada da API Key.

Sem parâmetros além da autenticação.

curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/services" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/services" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/services",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
POST/v1/servicesservices:writecreateService

Requer `services:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "name": "Maria Souza",
  "active": true,
  "price_type": "fixo"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X POST "https://api.crm.agenciagens.com.br/v1/services" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "name": "Maria Souza",
  "active": true,
  "price_type": "fixo"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "name": "Maria Souza",
  "active": true,
  "price_type": "fixo"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method POST -Uri "https://api.crm.agenciagens.com.br/v1/services" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "name": "Maria Souza",
  "active": true,
  "price_type": "fixo"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/services",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
PATCH/v1/services/{service_id}services:writeupdateService

Requer `services:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
service_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "name": "Maria Souza",
  "active": true
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X PATCH "https://api.crm.agenciagens.com.br/v1/services/{service_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "name": "Maria Souza",
  "active": true
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "name": "Maria Souza",
  "active": true
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method PATCH -Uri "https://api.crm.agenciagens.com.br/v1/services/{service_id}" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "name": "Maria Souza",
  "active": true
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/services/{service_id}",
  {
    method: "PATCH",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
DELETE/v1/services/{service_id}services:writedeactivateService

Requer `services:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
service_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X DELETE "https://api.crm.agenciagens.com.br/v1/services/{service_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method DELETE -Uri "https://api.crm.agenciagens.com.br/v1/services/{service_id}" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/services/{service_id}",
  {
    method: "DELETE",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.

Agendamentos 5

GET/v1/appointmentsappointments:readlistAppointments

Requer `appointments:read`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
limitqueryItens por página. Padrão 50; máximo 100.
cursorqueryCursor opaco devolvido em next_cursor. Não altere o valor.
contact_idqueryContato.
statusqueryStatus do agendamento.
starts_fromqueryInício UTC.
starts_toqueryFim UTC.
curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/appointments?limit=50" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/appointments?limit=50" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/appointments?limit=50",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
POST/v1/appointmentsappointments:writecreateAppointment

Requer `appointments:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "contact_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d",
  "user_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d",
  "title": "texto de exemplo",
  "starts_at": "2026-08-22T12:00:00Z",
  "ends_at": "2026-08-22T12:00:00Z",
  "status": "agendado"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X POST "https://api.crm.agenciagens.com.br/v1/appointments" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "contact_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d",
  "user_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d",
  "title": "texto de exemplo",
  "starts_at": "2026-08-22T12:00:00Z",
  "ends_at": "2026-08-22T12:00:00Z",
  "status": "agendado"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "contact_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d",
  "user_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d",
  "title": "texto de exemplo",
  "starts_at": "2026-08-22T12:00:00Z",
  "ends_at": "2026-08-22T12:00:00Z",
  "status": "agendado"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method POST -Uri "https://api.crm.agenciagens.com.br/v1/appointments" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "contact_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d",
  "user_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d",
  "title": "texto de exemplo",
  "starts_at": "2026-08-22T12:00:00Z",
  "ends_at": "2026-08-22T12:00:00Z",
  "status": "agendado"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/appointments",
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
GET/v1/appointments/{appointment_id}appointments:readgetAppointment

Requer `appointments:read`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
appointment_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/appointments/{appointment_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/appointments/{appointment_id}" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/appointments/{appointment_id}",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
PATCH/v1/appointments/{appointment_id}appointments:writeupdateAppointment

Requer `appointments:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
appointment_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "contact_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d",
  "user_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X PATCH "https://api.crm.agenciagens.com.br/v1/appointments/{appointment_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "contact_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d",
  "user_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "contact_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d",
  "user_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method PATCH -Uri "https://api.crm.agenciagens.com.br/v1/appointments/{appointment_id}" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z",
  "contact_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d",
  "user_id": "b1c2d3e4-5f60-4a7b-8c9d-0e1f2a3b4c5d"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/appointments/{appointment_id}",
  {
    method: "PATCH",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
DELETE/v1/appointments/{appointment_id}appointments:writecancelAppointment

Requer `appointments:write`. A conta é sempre derivada da API Key.

ParâmetroEmDescrição
appointment_id (obrigatório)pathUUID do recurso pertencente à conta autenticada.
Idempotency-Key (obrigatório)headerValor único de 8 a 128 caracteres para repetir a mesma mutação com segurança.
Payload
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}

Este exemplo altera dados. Substitua IDs e datas fictícios, confirme a ação e defina GENS_IDEMPOTENCY_KEY uma vez por operação. Preserve-a nos retries. Entenda a idempotência.

curl
# Defina GENS_IDEMPOTENCY_KEY uma vez por operação e preserve-a nos retries.
: "${GENS_IDEMPOTENCY_KEY:?Defina a chave desta operação antes de enviar}"
curl -sS -X DELETE "https://api.crm.agenciagens.com.br/v1/appointments/{appointment_id}" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ${GENS_IDEMPOTENCY_KEY}" \
  --data '{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}'
powershell
# Prepare uma chave por operação; não gere outra ao repetir este envio.
if (-not $env:GENS_IDEMPOTENCY_KEY) { throw "Defina GENS_IDEMPOTENCY_KEY para esta operação." }
$body = @'
{
  "expected_updated_at": "2026-08-22T12:00:00Z"
}
'@

$headers = @{
  Authorization = "Bearer $env:GENS_CLINIC_API_KEY"
  "Idempotency-Key" = $env:GENS_IDEMPOTENCY_KEY
}

Invoke-RestMethod -Method DELETE -Uri "https://api.crm.agenciagens.com.br/v1/appointments/{appointment_id}" -Headers $headers -ContentType "application/json" -Body $body
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
// Preserve esta chave e este corpo ao repetir a mesma operação.
if (!process.env.GENS_IDEMPOTENCY_KEY) throw new Error("Defina a chave desta operação.");
const body = {
  "expected_updated_at": "2026-08-22T12:00:00Z"
};

const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/appointments/{appointment_id}",
  {
    method: "DELETE",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": process.env.GENS_IDEMPOTENCY_KEY,
    },
    body: JSON.stringify(body),
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.

API 7

GET/v1/metrics/cataloganalytics:readgetMetricsCatalog

Requer `analytics:read`. A conta é sempre derivada da API Key.

Sem parâmetros além da autenticação.

curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/metrics/catalog" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/metrics/catalog" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/metrics/catalog",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
GET/v1/metrics/commercialanalytics:commercial:readgetCommercialMetrics

Requer `analytics:commercial:read`. A conta é sempre derivada da API Key.

Sem parâmetros além da autenticação.

curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/metrics/commercial" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/metrics/commercial" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/metrics/commercial",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
GET/v1/metrics/follow-upsanalytics:followups:readgetFollowUpAnalytics

Requer `analytics:followups:read`. A conta é sempre derivada da API Key.

Sem parâmetros além da autenticação.

curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/metrics/follow-ups" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/metrics/follow-ups" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/metrics/follow-ups",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
GET/v1/metrics/dispatchesanalytics:dispatches:readgetDispatchMetrics

Requer `analytics:dispatches:read`. A conta é sempre derivada da API Key.

Sem parâmetros além da autenticação.

curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/metrics/dispatches" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/metrics/dispatches" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/metrics/dispatches",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
GET/v1/metrics/conversationsanalytics:conversations:readgetConversationMetrics

Requer `analytics:conversations:read`. A conta é sempre derivada da API Key.

Sem parâmetros além da autenticação.

curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/metrics/conversations" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/metrics/conversations" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/metrics/conversations",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
GET/v1/metrics/operationsanalytics:operations:readgetOperationMetrics

Requer `analytics:operations:read`. A conta é sempre derivada da API Key.

Sem parâmetros além da autenticação.

curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/metrics/operations" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/metrics/operations" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/metrics/operations",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.
GET/v1/metrics/detailsanalytics:readlistMetricDetails

Requer `analytics:read`. A conta é sempre derivada da API Key.

Sem parâmetros além da autenticação.

curl
curl -sS -X GET "https://api.crm.agenciagens.com.br/v1/metrics/details" \
  -H "Authorization: Bearer ${GENS_CLINIC_API_KEY}"
powershell
$headers = @{ Authorization = "Bearer $env:GENS_CLINIC_API_KEY" }

Invoke-RestMethod -Method GET -Uri "https://api.crm.agenciagens.com.br/v1/metrics/details" -Headers $headers
javascript
// Execute somente no servidor; configure os segredos no ambiente protegido.
if (!process.env.GENS_CLINIC_API_KEY) throw new Error("Configure a API Key no servidor.");
const response = await fetch(
  "https://api.crm.agenciagens.com.br/v1/metrics/details",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.GENS_CLINIC_API_KEY}`,
    },
  },
);

if (!response.ok) throw new Error(`HTTP ${response.status}; request_id=${response.headers.get("X-Request-Id") ?? "indisponível"}`);
const result = await response.json();
// Processe result sem registrar dados pessoais em logs.