Ver .md

proposals.create

Consolidar proposta. Gera uma proposta a partir de um modelo ativo, para um contato (contactId) e, se houver, uma oportunidade dele (opportunityId). A proposta nasce em rascunho, com o título e a capa do modelo. O link público ainda não existe no Atomiks: slug é o identificador reservado para ele. Sem a migration do banco responde migration_pendente.

  • Endpoint: POST https://app.atomiks.com.br/api/v1/proposals.create (corpo JSON)
  • Quem pode chamar: membro da conta
  • Escopo da chave: crm:write
  • Grava dados: sim
  • Pela chave de API: sim
  • Ferramenta MCP: proposals_create
  • Ficha em JSON: https://app.atomiks.com.br/api/v1/openapi.json (operationId proposals.create)

Entrada

CampoTipoObrigatórioNota
templateIdstring (uuid)sim
contactIdstring (uuid)não
opportunityIdstring (uuid)não
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "templateId": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "contactId": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "opportunityId": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    }
  },
  "required": [
    "templateId"
  ]
}

Exemplo

curl -X POST https://app.atomiks.com.br/api/v1/proposals.create \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"templateId":"00000000-0000-0000-0000-000000000000","contactId":"00000000-0000-0000-0000-000000000000"}'

CLI:

node cli/atomiks.mjs proposals.create --json '{"templateId":"00000000-0000-0000-0000-000000000000","contactId":"00000000-0000-0000-0000-000000000000"}'

MCP: ferramenta proposals_create com a mesma entrada.

Saída

Sucesso: {"data": ...} com o formato abaixo.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "slug": {
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "enum": [
        "slide_deck",
        "document",
        "pdf"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "draft",
        "sent",
        "viewed",
        "accepted",
        "rejected",
        "expired"
      ]
    },
    "coverHtml": {
      "type": [
        "string",
        "null"
      ]
    },
    "templateId": {
      "type": [
        "string",
        "null"
      ]
    },
    "templateName": {
      "type": [
        "string",
        "null"
      ]
    },
    "leadId": {
      "type": [
        "string",
        "null"
      ]
    },
    "leadName": {
      "type": [
        "string",
        "null"
      ]
    },
    "opportunityId": {
      "type": [
        "string",
        "null"
      ]
    },
    "opportunityTitle": {
      "type": [
        "string",
        "null"
      ]
    },
    "opportunityValue": {
      "type": [
        "number",
        "null"
      ]
    },
    "viewedAt": {
      "type": [
        "string",
        "null"
      ]
    },
    "createdAt": {
      "type": "string"
    }
  },
  "required": [
    "id",
    "slug",
    "title",
    "kind",
    "status",
    "coverHtml",
    "templateId",
    "templateName",
    "leadId",
    "leadName",
    "opportunityId",
    "opportunityTitle",
    "opportunityValue",
    "viewedAt",
    "createdAt"
  ],
  "additionalProperties": false
}

Erros

{"error": {"code", "message", "requestId"}}. Códigos: invalid_input (400), unauthorized (401), forbidden / account_pending / scope_missing (403), not_found (404), limit_reached (409), internal (500).