{
  "openapi": "3.1.0",
  "info": {
    "title": "Pongg event subscription API",
    "version": "1.0.0",
    "description": "The three public Pongg event API routes. Not a general CRM, call-history or booking API. Webhook fan-out is best-effort with one attempt, no public replay endpoint and no receiver-accessible signing secret. Examples are synthetic."
  },
  "servers": [
    {
      "url": "https://app.pongg.com/api/zapier"
    }
  ],
  "security": [
    {
      "PonggKey": []
    }
  ],
  "paths": {
    "/subscribe": {
      "post": {
        "operationId": "subscribe",
        "summary": "Create a lead/booking subscription",
        "description": "Non-idempotent: repeating the request can create duplicate subscriptions. Reachability and target safety are not checked at registration. Recognized events are lead, booking, all; unknown strings are accepted but do not match fan-out.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "targetUrl": {
                    "type": "string",
                    "description": "Public receiver URL. Use HTTPS. Delivery-time guard rejects unsafe targets."
                  },
                  "event": {
                    "type": "string",
                    "default": "lead",
                    "description": "Recognized values: lead, booking, all. The current API does not validate this against an enum."
                  }
                },
                "required": [
                  "targetUrl"
                ],
                "additionalProperties": true
              },
              "example": {
                "targetUrl": "https://receiver.example.com/pongg",
                "event": "all"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Subscription stored; does not verify reachability.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id"
                  ]
                },
                "example": {
                  "id": "11111111-1111-4111-8111-111111111111"
                }
              }
            }
          },
          "400": {
            "description": "Pongg could not accept that request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "That Pongg key is not valid. Open Integrations in Pongg and create a new one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown endpoint or subscription owned by another account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests to Pongg. Wait a minute and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait before another API request."
              }
            }
          },
          "502": {
            "description": "Pongg could not be reached just now. Try again shortly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/subscribe/{id}": {
      "delete": {
        "operationId": "unsubscribe",
        "summary": "Remove an account-owned subscription",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Removed. No response body."
          },
          "400": {
            "description": "Pongg could not accept that request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "That Pongg key is not valid. Open Integrations in Pongg and create a new one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown endpoint or subscription owned by another account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests to Pongg. Wait a minute and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait before another API request."
              }
            }
          },
          "502": {
            "description": "Pongg could not be reached just now. Try again shortly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/perform-list": {
      "get": {
        "operationId": "preview",
        "summary": "Preview setup samples, not a history feed",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 20,
              "default": 3
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Preview records. Existing deliveries omit captured contact identity and have empty summary/job_type. An account with no deliveries returns a synthetic example.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "maxItems": 20,
                  "items": {
                    "$ref": "#/components/schemas/Preview"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Pongg could not accept that request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "That Pongg key is not valid. Open Integrations in Pongg and create a new one.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown endpoint or subscription owned by another account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests to Pongg. Wait a minute and try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds to wait before another API request."
              }
            }
          },
          "502": {
            "description": "Pongg could not be reached just now. Try again shortly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "PonggKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "A Pongg account integration key created by its owner/admin in Integrations. No tenant id is supplied by API callers."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "retryAfterSeconds": {
            "type": "integer"
          }
        },
        "required": [
          "error"
        ]
      },
      "Contact": {
        "type": "object",
        "properties": {
          "full_name": {
            "type": "string"
          },
          "first_name": {
            "type": "string"
          },
          "last_name": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "postal_code": {
            "type": "string"
          }
        },
        "required": [
          "full_name",
          "first_name",
          "last_name",
          "phone",
          "email",
          "address"
        ],
        "additionalProperties": true
      },
      "Preview": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "call_id": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "contact": {
            "type": "object",
            "additionalProperties": true
          },
          "job_type": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "booked": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "call_id",
          "source",
          "contact",
          "job_type",
          "summary",
          "booked"
        ],
        "additionalProperties": true
      },
      "LeadEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "call_id": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "contact": {
            "$ref": "#/components/schemas/Contact"
          },
          "job_type": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "location": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ]
          },
          "urgency": {
            "type": "string"
          },
          "booked": {
            "const": false
          },
          "appointment": {
            "type": "null"
          },
          "event": {
            "const": "lead"
          }
        },
        "required": [
          "id",
          "call_id",
          "source",
          "provider",
          "occurred_at",
          "contact",
          "job_type",
          "summary",
          "urgency",
          "booked",
          "appointment",
          "event"
        ],
        "additionalProperties": true
      },
      "BookingEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "call_id": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "contact": {
            "$ref": "#/components/schemas/Contact"
          },
          "job_type": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "location": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ]
          },
          "appointment": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "properties": {
                  "timezone": {
                    "type": "string"
                  },
                  "start": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "end": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "slot_text": {
                    "type": "string"
                  },
                  "job_type": {
                    "type": "string"
                  },
                  "address": {
                    "type": "string"
                  },
                  "status": {
                    "type": "string",
                    "description": "Canonical appointment status; requested needs confirmation. Not an independent provider write receipt."
                  }
                },
                "required": [
                  "timezone",
                  "start",
                  "end",
                  "slot_text",
                  "job_type",
                  "address",
                  "status"
                ]
              }
            ]
          },
          "event": {
            "const": "booking"
          }
        },
        "required": [
          "id",
          "call_id",
          "source",
          "provider",
          "occurred_at",
          "contact",
          "job_type",
          "summary",
          "appointment",
          "event"
        ],
        "additionalProperties": true
      }
    }
  },
  "webhooks": {
    "lead": {
      "post": {
        "security": [],
        "description": "Outbound event to your registered targetUrl. One best-effort POST. X-CenterCrest-Signature is sent but the signing secret is not exposed to receivers; the header alone does not authenticate the sender.",
        "parameters": [
          {
            "name": "X-CenterCrest-Signature",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "description": "sha256=<HMAC-SHA256>. No receiver signing secret is currently available."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadEvent"
              },
              "example": {
                "id": "5b1c9e3a-2f0d-4b7a-9c8e-1a2b3c4d5e6f",
                "call_id": "call_2f7a1c9e8b3d",
                "source": "Pongg (phone)",
                "provider": "",
                "occurred_at": "2026-09-21T15:04:05+00:00",
                "contact": {
                  "full_name": "Jane Sample",
                  "first_name": "Jane",
                  "last_name": "Sample",
                  "phone": "+15555550123",
                  "email": "jane@example.com",
                  "address": "12 Oak Street"
                },
                "job_type": "Estimate",
                "summary": "Wants a quote for a new roof",
                "urgency": "This week",
                "booked": false,
                "appointment": null,
                "event": "lead"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Receiver accepted the event. Persist and deduplicate within your receiver."
          }
        }
      }
    },
    "booking": {
      "post": {
        "security": [],
        "description": "Outbound event to your registered targetUrl. One best-effort POST. X-CenterCrest-Signature is sent but the signing secret is not exposed to receivers; the header alone does not authenticate the sender.",
        "parameters": [
          {
            "name": "X-CenterCrest-Signature",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "description": "sha256=<HMAC-SHA256>. No receiver signing secret is currently available."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BookingEvent"
              },
              "example": {
                "id": "b7e2a1d4-6c3f-4a9b-8e2d-5f1c9a3b7e4d",
                "call_id": "call_9a3f7c1e2b8d",
                "source": "Pongg (phone)",
                "provider": "",
                "occurred_at": "2026-09-21T15:04:05+00:00",
                "contact": {
                  "full_name": "Jane Sample",
                  "first_name": "Jane",
                  "last_name": "Sample",
                  "phone": "+15555550123",
                  "email": "jane@example.com",
                  "address": "12 Oak Street"
                },
                "job_type": "Roof inspection",
                "summary": "Booked an inspection for the leak over the garage",
                "appointment": {
                  "timezone": "America/Chicago",
                  "start": "2026-09-23T14:00:00+00:00",
                  "end": null,
                  "slot_text": "Wednesday 9am",
                  "job_type": "Roof inspection",
                  "address": "12 Oak Street",
                  "status": "scheduled"
                },
                "event": "booking"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Receiver accepted the event. Persist and deduplicate within your receiver."
          }
        }
      }
    }
  }
}
