{
  "openapi": "3.1.0",
  "info": {
    "title": "RevFirst API",
    "version": "1.0.0",
    "summary": "Read the people RevFirst finds, your campaigns and replies; add people to campaigns.",
    "description": "The RevFirst API gives your own systems the same results you see in the RevFirst app: the people RevFirst found and why now, your campaigns and their numbers, and the replies they get. Authenticate with a workspace API key. Every response is JSON.",
    "contact": {
      "name": "RevFirst",
      "url": "https://www.revfirst.co/developers",
      "email": "satvik@revfirst.co"
    },
    "termsOfService": "https://www.revfirst.co/terms"
  },
  "externalDocs": {
    "description": "RevFirst developer docs",
    "url": "https://www.revfirst.co/developers"
  },
  "servers": [
    {
      "url": "https://app.revfirst.co/api/v1",
      "description": "Production"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "tags": [
    {
      "name": "People",
      "description": "Everyone RevFirst found for you, with the signal and the reason to reach out."
    },
    {
      "name": "Campaigns",
      "description": "Your campaigns, their numbers, and adding people to them."
    },
    {
      "name": "Replies",
      "description": "Replies from people, newest first."
    }
  ],
  "paths": {
    "/people": {
      "get": {
        "operationId": "listPeople",
        "tags": [
          "People"
        ],
        "summary": "List people",
        "description": "Everyone RevFirst found, newest first, with the signal and the reason to reach out. Cursor-paginated.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Items per page, 1 to 100."
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "The next_cursor from the previous page. Leave out for the first page."
          },
          {
            "name": "campaign_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Only people in this campaign."
          },
          {
            "name": "signal",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "hiring",
                "job_change",
                "funding",
                "post_engager",
                "event_sponsor",
                "event_speaker",
                "event_going",
                "icp_fit",
                "lookalike",
                "news",
                "competitor"
              ]
            },
            "description": "Only people found by this kind of signal."
          },
          {
            "name": "since",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Only people found on or after this time (ISO 8601).",
            "example": "2026-11-01T00:00:00Z"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of people.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "next_cursor"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Person"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Pass as cursor for the next page. null on the last page."
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "id": "3f2a8c1e-6b0d-4c47-9a51-2f1f0c9d7e11",
                      "name": "Jane Doe",
                      "title": "Head of Sales",
                      "company": "Acme",
                      "company_domain": "acme.com",
                      "email": "jane@acme.com",
                      "linkedin_url": "https://www.linkedin.com/in/example-jane-doe",
                      "signal": "hiring",
                      "reason": "Hiring 3 SDRs this month",
                      "signal_url": "https://acme.com/careers/sdr",
                      "campaign_id": "9b1c4e2a-0f3d-4a8b-b6c5-7d2e1f0a9c33",
                      "status": "active",
                      "found_at": "2026-11-24T09:30:00.000Z"
                    }
                  ],
                  "next_cursor": "WyIyMDI2LTExLTI0VDA5OjMwOjAwLjAwMFoiLCIzZjJhOGMxZS0uLi4iXQ"
                }
              }
            }
          },
          "400": {
            "description": "A filter isn’t valid (bad_cursor, bad_campaign_id or bad_since).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "bad_since",
                    "message": "since must be an ISO date."
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or wrong API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "unauthorized",
                    "message": "Send your API key as: Authorization: Bearer rf_live_…"
                  }
                }
              }
            }
          },
          "429": {
            "description": "Over the rate limit. Wait for Retry-After seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "rate_limited",
                    "message": "Too many requests: up to 120 a minute per key. Try again in 12 s."
                  }
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until you can call again."
              }
            }
          },
          "500": {
            "description": "Something failed on our side. Safe to retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "server_error",
                    "message": "Something went wrong on our side. Try again."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/people/{id}": {
      "get": {
        "operationId": "getPerson",
        "tags": [
          "People"
        ],
        "summary": "Retrieve a person",
        "description": "One person, with up to 20 of their most recent replies.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The person’s id."
          }
        ],
        "responses": {
          "200": {
            "description": "The person.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/Person"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "replies": {
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/Reply"
                              }
                            }
                          }
                        }
                      ]
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": "3f2a8c1e-6b0d-4c47-9a51-2f1f0c9d7e11",
                    "name": "Jane Doe",
                    "title": "Head of Sales",
                    "company": "Acme",
                    "company_domain": "acme.com",
                    "email": "jane@acme.com",
                    "linkedin_url": "https://www.linkedin.com/in/example-jane-doe",
                    "signal": "hiring",
                    "reason": "Hiring 3 SDRs this month",
                    "signal_url": "https://acme.com/careers/sdr",
                    "campaign_id": "9b1c4e2a-0f3d-4a8b-b6c5-7d2e1f0a9c33",
                    "status": "active",
                    "found_at": "2026-11-24T09:30:00.000Z",
                    "replies": [
                      {
                        "id": "5d1e7a90-2b3c-4d5e-8f60-718293a4b5c6",
                        "channel": "email",
                        "text": "Sounds good, send me some times next week.",
                        "tag": "meeting_request",
                        "received_at": "2026-11-25T06:12:44.000Z"
                      }
                    ]
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or wrong API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "unauthorized",
                    "message": "Send your API key as: Authorization: Bearer rf_live_…"
                  }
                }
              }
            }
          },
          "404": {
            "description": "No person with that id in your workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "No person with that id."
                  }
                }
              }
            }
          },
          "429": {
            "description": "Over the rate limit. Wait for Retry-After seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "rate_limited",
                    "message": "Too many requests: up to 120 a minute per key. Try again in 12 s."
                  }
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until you can call again."
              }
            }
          },
          "500": {
            "description": "Something failed on our side. Safe to retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "server_error",
                    "message": "Something went wrong on our side. Try again."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/lookup": {
      "get": {
        "operationId": "lookupPerson",
        "tags": [
          "People"
        ],
        "summary": "Look up a LinkedIn profile",
        "description": "What RevFirst knows about one LinkedIn profile. Returns data: null when the person isn’t in your workspace. Useful in browser extensions and CRMs.",
        "parameters": [
          {
            "name": "linkedin_url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "A LinkedIn profile link (linkedin.com/in/…). Any form works; it’s matched on the profile handle.",
            "example": "https://www.linkedin.com/in/example-jane-doe"
          }
        ],
        "responses": {
          "200": {
            "description": "The person, or null.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/Person"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": "3f2a8c1e-6b0d-4c47-9a51-2f1f0c9d7e11",
                    "name": "Jane Doe",
                    "title": "Head of Sales",
                    "company": "Acme",
                    "company_domain": "acme.com",
                    "email": "jane@acme.com",
                    "linkedin_url": "https://www.linkedin.com/in/example-jane-doe",
                    "signal": "hiring",
                    "reason": "Hiring 3 SDRs this month",
                    "signal_url": "https://acme.com/careers/sdr",
                    "campaign_id": "9b1c4e2a-0f3d-4a8b-b6c5-7d2e1f0a9c33",
                    "status": "active",
                    "found_at": "2026-11-24T09:30:00.000Z"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Not a LinkedIn profile link.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "bad_linkedin_url",
                    "message": "Pass a LinkedIn profile link (linkedin.com/in/…)."
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or wrong API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "unauthorized",
                    "message": "Send your API key as: Authorization: Bearer rf_live_…"
                  }
                }
              }
            }
          },
          "429": {
            "description": "Over the rate limit. Wait for Retry-After seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "rate_limited",
                    "message": "Too many requests: up to 120 a minute per key. Try again in 12 s."
                  }
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until you can call again."
              }
            }
          },
          "500": {
            "description": "Something failed on our side. Safe to retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "server_error",
                    "message": "Something went wrong on our side. Try again."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/campaigns": {
      "get": {
        "operationId": "listCampaigns",
        "tags": [
          "Campaigns"
        ],
        "summary": "List campaigns",
        "description": "Your campaigns, newest first (up to 200), each with its status and numbers: people, contacted, replied and interested.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Your campaigns.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Campaign"
                      }
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "id": "9b1c4e2a-0f3d-4a8b-b6c5-7d2e1f0a9c33",
                      "name": "Hiring SDRs",
                      "status": "active",
                      "channel": "email_linkedin",
                      "play": "Hiring signal",
                      "launched_at": "2026-11-18T04:00:00.000Z",
                      "created_at": "2026-11-17T11:20:00.000Z",
                      "stats": {
                        "people": 184,
                        "contacted": 152,
                        "replied": 19,
                        "interested": 6
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or wrong API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "unauthorized",
                    "message": "Send your API key as: Authorization: Bearer rf_live_…"
                  }
                }
              }
            }
          },
          "429": {
            "description": "Over the rate limit. Wait for Retry-After seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "rate_limited",
                    "message": "Too many requests: up to 120 a minute per key. Try again in 12 s."
                  }
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until you can call again."
              }
            }
          },
          "500": {
            "description": "Something failed on our side. Safe to retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "server_error",
                    "message": "Something went wrong on our side. Try again."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/campaigns/{id}/people": {
      "post": {
        "operationId": "addPersonToCampaign",
        "tags": [
          "Campaigns"
        ],
        "summary": "Add a person to a campaign",
        "description": "Adds one person to a campaign. They are contacted on the campaign’s own schedule, once its play is approved. If the person is already in your workspace (matched on LinkedIn profile, then email) and in no campaign, they are moved in and created is false. People on your do-not-contact list, or already in another campaign, are refused.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The campaign’s id."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "description": "Send linkedin_url, email, or both.",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Full name, 1 to 120 characters.",
                    "maxLength": 120
                  },
                  "linkedin_url": {
                    "type": "string",
                    "description": "LinkedIn profile link (linkedin.com/in/…).",
                    "maxLength": 300
                  },
                  "email": {
                    "type": "string",
                    "description": "Work email.",
                    "format": "email",
                    "maxLength": 200
                  },
                  "title": {
                    "type": "string",
                    "description": "Job title.",
                    "maxLength": 160
                  },
                  "company": {
                    "type": "string",
                    "description": "Company name.",
                    "maxLength": 160
                  },
                  "reason": {
                    "type": "string",
                    "description": "Why reach out now, in plain words. Used in the outreach.",
                    "maxLength": 500
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "api",
                      "extension"
                    ],
                    "default": "api",
                    "description": "Where the person came from."
                  }
                },
                "anyOf": [
                  {
                    "required": [
                      "linkedin_url"
                    ]
                  },
                  {
                    "required": [
                      "email"
                    ]
                  }
                ]
              },
              "example": {
                "name": "Jane Doe",
                "linkedin_url": "https://www.linkedin.com/in/example-jane-doe",
                "email": "jane@acme.com",
                "title": "Head of Sales",
                "company": "Acme",
                "reason": "Asked about pricing at our webinar"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Already in your workspace with no campaign: moved into this one.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Person"
                    },
                    "created": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": "3f2a8c1e-6b0d-4c47-9a51-2f1f0c9d7e11",
                    "name": "Jane Doe",
                    "title": "Head of Sales",
                    "company": "Acme",
                    "company_domain": "acme.com",
                    "email": "jane@acme.com",
                    "linkedin_url": "https://www.linkedin.com/in/example-jane-doe",
                    "signal": "hiring",
                    "reason": "Hiring 3 SDRs this month",
                    "signal_url": "https://acme.com/careers/sdr",
                    "campaign_id": "9b1c4e2a-0f3d-4a8b-b6c5-7d2e1f0a9c33",
                    "status": "active",
                    "found_at": "2026-11-24T09:30:00.000Z"
                  },
                  "created": false
                }
              }
            }
          },
          "201": {
            "description": "Added as a new person.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Person"
                    },
                    "created": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": "3f2a8c1e-6b0d-4c47-9a51-2f1f0c9d7e11",
                    "name": "Jane Doe",
                    "title": "Head of Sales",
                    "company": "Acme",
                    "company_domain": "acme.com",
                    "email": "jane@acme.com",
                    "linkedin_url": "https://www.linkedin.com/in/example-jane-doe",
                    "signal": null,
                    "reason": "Asked about pricing at our webinar",
                    "signal_url": null,
                    "campaign_id": "9b1c4e2a-0f3d-4a8b-b6c5-7d2e1f0a9c33",
                    "status": "new",
                    "found_at": "2026-11-24T09:30:00.000Z"
                  },
                  "created": true
                }
              }
            }
          },
          "400": {
            "description": "The body isn’t valid (bad_body) or the LinkedIn link isn’t a profile (bad_linkedin_url).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "bad_body",
                    "message": "linkedin_url or email is needed"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or wrong API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "unauthorized",
                    "message": "Send your API key as: Authorization: Bearer rf_live_…"
                  }
                }
              }
            }
          },
          "404": {
            "description": "No campaign with that id in your workspace.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "No campaign with that id."
                  }
                }
              }
            }
          },
          "409": {
            "description": "Refused: campaign_finished, do_not_contact, in_another_campaign or duplicate.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "do_not_contact",
                    "message": "This person is on your do-not-contact list."
                  }
                }
              }
            }
          },
          "429": {
            "description": "Over the rate limit. Wait for Retry-After seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "rate_limited",
                    "message": "Too many requests: up to 120 a minute per key. Try again in 12 s."
                  }
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until you can call again."
              }
            }
          },
          "500": {
            "description": "Something failed on our side. Safe to retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "server_error",
                    "message": "Something went wrong on our side. Try again."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/replies": {
      "get": {
        "operationId": "listReplies",
        "tags": [
          "Replies"
        ],
        "summary": "List replies",
        "description": "Replies from people, newest first. Out-of-office messages and bounces are left out. Cursor-paginated.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Items per page, 1 to 100."
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "The next_cursor from the previous page. Leave out for the first page."
          },
          {
            "name": "since",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Only replies received on or after this time (ISO 8601).",
            "example": "2026-11-01T00:00:00Z"
          },
          {
            "name": "interested",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "true: only replies tagged interested, meeting_request or info_request."
          }
        ],
        "responses": {
          "200": {
            "description": "A page of replies.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ReplyListItem"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "id": "5d1e7a90-2b3c-4d5e-8f60-718293a4b5c6",
                      "person_id": "3f2a8c1e-6b0d-4c47-9a51-2f1f0c9d7e11",
                      "person": {
                        "name": "Jane Doe",
                        "company": "Acme",
                        "email": "jane@acme.com",
                        "linkedin_url": "https://www.linkedin.com/in/example-jane-doe"
                      },
                      "campaign_id": "9b1c4e2a-0f3d-4a8b-b6c5-7d2e1f0a9c33",
                      "channel": "email",
                      "text": "Sounds good, send me some times next week.",
                      "tag": "meeting_request",
                      "interested": true,
                      "received_at": "2026-11-25T06:12:44.000Z"
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "description": "A filter isn’t valid (bad_cursor or bad_since).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "bad_cursor",
                    "message": "That cursor isn’t valid. Start without one."
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or wrong API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "unauthorized",
                    "message": "Send your API key as: Authorization: Bearer rf_live_…"
                  }
                }
              }
            }
          },
          "429": {
            "description": "Over the rate limit. Wait for Retry-After seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "rate_limited",
                    "message": "Too many requests: up to 120 a minute per key. Try again in 12 s."
                  }
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until you can call again."
              }
            }
          },
          "500": {
            "description": "Something failed on our side. Safe to retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "server_error",
                    "message": "Something went wrong on our side. Try again."
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {
    "reply.received": {
      "post": {
        "summary": "Someone replied",
        "description": "Sent when someone replies on email or LinkedIn. Out-of-office messages and bounces are not sent.",
        "parameters": [
          {
            "name": "RevFirst-Event",
            "in": "header",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "RevFirst-Delivery",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "description": "The event id. Same as the body’s id."
          },
          {
            "name": "RevFirst-Signature",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "description": "t=<unix seconds>,v1=<hex HMAC-SHA256 of \"t.body\">"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received. Any other answer, or none within 10 s, is retried."
          }
        }
      }
    },
    "lead.interested": {
      "post": {
        "summary": "A lead is interested",
        "description": "Sent when a reply is tagged interested, meeting_request or info_request. Includes the deal id RevFirst created.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received."
          }
        }
      }
    },
    "meeting.booked": {
      "post": {
        "summary": "A meeting is booked",
        "description": "Sent when someone books through your calendar link.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Received."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "rf_live_…",
        "description": "A workspace API key from Integrations → API & webhooks in the RevFirst app."
      }
    },
    "schemas": {
      "Person": {
        "type": "object",
        "description": "Someone RevFirst found (or you added), with the signal that makes now a good time to reach out.",
        "required": [
          "id",
          "name",
          "status",
          "found_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique id of the person in your workspace."
          },
          "name": {
            "type": "string",
            "description": "Full name."
          },
          "title": {
            "type": [
              "string",
              "null"
            ],
            "description": "Job title."
          },
          "company": {
            "type": [
              "string",
              "null"
            ],
            "description": "Company name."
          },
          "company_domain": {
            "type": [
              "string",
              "null"
            ],
            "description": "Company website domain, e.g. acme.com."
          },
          "email": {
            "type": [
              "string",
              "null"
            ],
            "description": "Work email, when known.",
            "format": "email"
          },
          "linkedin_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "LinkedIn profile link (https://www.linkedin.com/in/…)."
          },
          "signal": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "hiring",
              "job_change",
              "funding",
              "post_engager",
              "event_sponsor",
              "event_speaker",
              "event_going",
              "icp_fit",
              "lookalike",
              "news",
              "competitor",
              null
            ],
            "description": "The kind of signal that found them."
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "The reason to reach out now, in plain words."
          },
          "signal_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "A public link to the evidence (a job post, a news story, a post), when there is one."
          },
          "campaign_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The campaign they are in."
          },
          "status": {
            "type": "string",
            "enum": [
              "new",
              "review",
              "approved",
              "scheduled",
              "active",
              "replied",
              "finished",
              "skipped",
              "failed"
            ],
            "description": "Where they are in outreach."
          },
          "found_at": {
            "type": "string",
            "description": "When RevFirst found or added them (ISO 8601).",
            "format": "date-time"
          }
        }
      },
      "Reply": {
        "type": "object",
        "description": "A reply from a person, on email or LinkedIn.",
        "required": [
          "id",
          "channel",
          "text",
          "received_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique id of the reply."
          },
          "channel": {
            "type": "string",
            "enum": [
              "email",
              "linkedin"
            ]
          },
          "text": {
            "type": "string",
            "description": "What they wrote."
          },
          "tag": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "interested",
              "meeting_request",
              "info_request",
              "question",
              "not_now",
              "not_interested",
              "wrong_person",
              "unsubscribe",
              "other",
              null
            ],
            "description": "RevFirst’s read of the reply."
          },
          "received_at": {
            "type": "string",
            "description": "When it arrived (ISO 8601).",
            "format": "date-time"
          }
        }
      },
      "ReplyListItem": {
        "type": "object",
        "required": [
          "id",
          "channel",
          "text",
          "interested",
          "received_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique id of the reply."
          },
          "person_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "The person who replied."
          },
          "person": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "name": {
                "type": "string",
                "description": "Full name."
              },
              "company": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Company."
              },
              "email": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Email."
              },
              "linkedin_url": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "LinkedIn profile link."
              }
            }
          },
          "campaign_id": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid"
          },
          "channel": {
            "type": "string",
            "enum": [
              "email",
              "linkedin"
            ]
          },
          "text": {
            "type": "string",
            "description": "What they wrote."
          },
          "tag": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "interested",
              "meeting_request",
              "info_request",
              "question",
              "not_now",
              "not_interested",
              "wrong_person",
              "unsubscribe",
              "other",
              null
            ]
          },
          "interested": {
            "type": "boolean",
            "description": "true when the tag is interested, meeting_request or info_request."
          },
          "received_at": {
            "type": "string",
            "description": "When it arrived (ISO 8601).",
            "format": "date-time"
          }
        }
      },
      "Campaign": {
        "type": "object",
        "required": [
          "id",
          "name",
          "status",
          "channel",
          "created_at",
          "stats"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique id of the campaign."
          },
          "name": {
            "type": "string",
            "description": "Campaign name."
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "queued",
              "ready",
              "active",
              "paused",
              "completed"
            ]
          },
          "channel": {
            "type": "string",
            "enum": [
              "email",
              "linkedin",
              "email_linkedin"
            ]
          },
          "play": {
            "type": [
              "string",
              "null"
            ],
            "description": "The play (sequence template) it runs."
          },
          "launched_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "stats": {
            "type": "object",
            "properties": {
              "people": {
                "type": "integer",
                "description": "People in the campaign."
              },
              "contacted": {
                "type": "integer",
                "description": "People sent at least one message."
              },
              "replied": {
                "type": "integer",
                "description": "People who replied."
              },
              "interested": {
                "type": "integer",
                "description": "People whose reply was tagged interested, meeting_request or info_request."
              }
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "description": "Stable, machine-readable code. Branch on this."
              },
              "message": {
                "type": "string",
                "description": "Plain-words explanation. Show it, don’t parse it."
              }
            }
          }
        }
      },
      "WebhookEvent": {
        "type": "object",
        "required": [
          "id",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Event id. The same event can arrive twice: handle each id once."
          },
          "type": {
            "type": "string",
            "enum": [
              "reply.received",
              "lead.interested",
              "meeting.booked"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "data": {
            "type": "object",
            "properties": {
              "person": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Person id."
                  },
                  "name": {
                    "type": "string",
                    "description": "Full name."
                  },
                  "title": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Title."
                  },
                  "company": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Company."
                  },
                  "email": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Email."
                  },
                  "linkedin_url": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "LinkedIn profile link."
                  },
                  "reason": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Why now."
                  }
                }
              },
              "reply": {
                "type": "object",
                "description": "reply.received and lead.interested.",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Reply id."
                  },
                  "channel": {
                    "type": "string",
                    "enum": [
                      "email",
                      "linkedin"
                    ]
                  },
                  "text": {
                    "type": "string",
                    "description": "What they wrote."
                  },
                  "received_at": {
                    "type": "string",
                    "format": "date-time"
                  }
                }
              },
              "meeting": {
                "type": "object",
                "description": "meeting.booked only.",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "Meeting id."
                  },
                  "starts_at": {
                    "type": "string",
                    "format": "date-time"
                  }
                }
              },
              "deal_id": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "lead.interested and meeting.booked: the deal RevFirst created."
              }
            }
          }
        }
      }
    }
  }
}