Ver .md

push.subscribe

Ativar push neste navegador. Guarda a assinatura Web Push (PushSubscription.toJSON()) do usuário. Repetir o mesmo endpoint atualiza as chaves.

  • Endpoint: POST https://app.atomiks.com.br/api/v1/push.subscribe (corpo JSON)
  • Quem pode chamar: qualquer usuário autenticado
  • Escopo da chave: nenhum (qualquer chave serve)
  • Grava dados: sim
  • Pela chave de API: sim
  • Ferramenta MCP: push_subscribe
  • Ficha em JSON: https://app.atomiks.com.br/api/v1/openapi.json (operationId push.subscribe)

Entrada

CampoTipoObrigatórioNota
endpointstring (uri)sim
keysobjectsim
userAgentstringnão
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "endpoint": {
      "type": "string",
      "maxLength": 2000,
      "format": "uri"
    },
    "keys": {
      "type": "object",
      "properties": {
        "p256dh": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "auth": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        }
      },
      "required": [
        "p256dh",
        "auth"
      ]
    },
    "userAgent": {
      "type": "string",
      "maxLength": 300
    }
  },
  "required": [
    "endpoint",
    "keys"
  ]
}

Exemplo

curl -X POST https://app.atomiks.com.br/api/v1/push.subscribe \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"endpoint":"https://push.example.com/abc","keys":{"p256dh":"BKey","auth":"secret"}}'

CLI:

node cli/atomiks.mjs push.subscribe --json '{"endpoint":"https://push.example.com/abc","keys":{"p256dh":"BKey","auth":"secret"}}'

MCP: ferramenta push_subscribe com a mesma entrada.

Saída

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

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean",
      "const": true
    }
  },
  "required": [
    "ok"
  ],
  "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).