{
  "openapi": "3.0.0",
  "info": {
    "title": "lemlist API",
    "version": "1.0.0",
    "description": "Welcome to the lemlist Developer Documentation.\n\nlemlist is very customizable and open. You'll find on this page all the API and integration you can do with lemlist.\n\n# Rate Limit\n\nlemlist's API rate limits requests in order to prevent abuse and overload of our services.  \nRate limits are applied on all routes and per API key performing the request.  \nThe rate limits are **20** requests per **2** seconds.  \nThe response provides any information you may need about it:\n\n| Header | Description |\n| --- | --- |\n| Retry-After | The number of seconds in which you can retry |\n| X-RateLimit-Limit | The maximum requests in that time |\n| X-RateLimit-Remaining | The number of remaining requests you can make |\n| X-RateLimit-Reset | The date when the rate limit will reset |\n\n_Example of values for the rate limit headers_\n\n``` json\n{\n    \"Retry-After\": 2,\n    \"X-RateLimit-Limit\": 20,\n    \"X-RateLimit-Remaining\": 7,\n    \"X-RateLimit-Reset\" : \"Tue Feb 16 2021 09:02:42 GMT+0100 (Central European Standard Time)\"\n}\n\n ```\n\n# Definitions\n\n## Team\n\nA team is the entity of lemlist that can handle users and billing.\n\n## Credits\n\nCredits are the coins a team uses to enrich emails, LinkedIn URLs, etc. via the enrich route. Each enrichment feature needs a certain amount of credits to run.\n\n## User\n\nYou use a user account to connect to lemlist and send messages via the connected emails or LinkedIn account.\n\n## Campaign\n\nA campaign is the entity to automate outreach. A campaign has multiple sequences composed of steps.\n\n## Lead\n\nA lead is a person that you try to contact via a campaign.\n\n## Activity\n\nAn activity is the history of all the steps.\n\n## Unsubscribe\n\nAn unsubscribe occurs when a person decides they don't want to receive emails from you anymore.\n\n# Authentication\n\nAll API routes use the dedicated subdomain `api.lemlist.com`.\n\nlemlist uses API keys to allow access to the API. You can get your lemlist API key at our [integration page](https://app.lemlist.com/settings/integrations).\n\nYou need to add the `Authorization` header using the `Basic` authentication type. `login:password` **where the login is always empty and the password is the API key**.\n\n⚠️ **Don't forget to add the semicolon (**`:`**) before your API key in curl command.**\n\n> To authorize, use this code: \n  \n\n``` shell\ncurl https://api.lemlist.com/api/team \\\n  --user \":YourApiKey\"\n\n ```\n\n**Make sure to replace** **`YourApiKey`** **with your API key.**\n\n# Give feedback\n\nIf you want to report a bug, ask for data, or share with us a use case, please fill this [form](https://lemlist.typeform.com/to/mfVlkyGf). It will help us centralize your needs!"
  },
  "servers": [
    {
      "url": "https://api.lemlist.com/api"
    }
  ],
  "security": [
    {
      "basicAuth": []
    }
  ],
  "components": {
    "securitySchemes": {
      "basicAuth": {
        "type": "http",
        "scheme": "basic"
      }
    },
    "schemas": {
      "Team": {
        "type": "object",
        "description": "The organization account that manages users and billing.",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Unique team identifier"
          },
          "name": {
            "type": "string",
            "description": "Team name"
          },
          "userIds": {
            "type": "array",
            "description": "User IDs in this team",
            "items": {
              "type": "string"
            }
          },
          "createdBy": {
            "type": "string",
            "description": "User ID who created the team"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "Date and time when the team was created"
          },
          "hooks": {
            "type": "array",
            "description": "Webhooks configured for the team",
            "items": {
              "$ref": "#/components/schemas/Webhook"
            }
          },
          "beta": {
            "type": "array",
            "description": "Beta features enabled for the team",
            "items": {
              "type": "string"
            }
          },
          "slackWebhook": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string",
                "format": "uri",
                "description": "Slack webhook URL for notifications"
              },
              "failCounter": {
                "type": "integer",
                "description": "Number of consecutive failed notifications"
              }
            },
            "description": "Slack webhooks configured for the team"
          },
          "invitedUsers": {
            "type": "array",
            "description": "Pending user invitations",
            "items": {
              "type": "object",
              "properties": {
                "email": {
                  "type": "string",
                  "format": "email"
                },
                "role": {
                  "type": "string"
                },
                "invitedBy": {
                  "type": "string"
                },
                "invitedAt": {
                  "type": "string",
                  "format": "date-time"
                }
              }
            }
          },
          "agency": {
            "type": "string",
            "description": "Agency identifier if team is part of an agency"
          },
          "pictureId": {
            "type": "string",
            "description": "Team profile picture file ID"
          },
          "customDomain": {
            "type": "string",
            "description": "Custom domain for the team"
          }
        }
      },
      "Credits": {
        "type": "object",
        "description": "Credits are the coins a team uses to enrich emails, LinkedIn URLs, etc. Each enrichment feature needs a certain amount of credits to run.",
        "properties": {
          "credits": {
            "type": "integer",
            "description": "Total credits remaining"
          },
          "details": {
            "type": "object",
            "properties": {
              "remaining": {
                "type": "object",
                "properties": {
                  "total": {
                    "type": "integer",
                    "description": "Total credits remaining"
                  },
                  "freemium": {
                    "type": "integer",
                    "description": "Freemium credits remaining"
                  },
                  "subscription": {
                    "type": "integer",
                    "description": "Subscription credits remaining"
                  },
                  "gifted": {
                    "type": "integer",
                    "description": "Gifted credits remaining"
                  },
                  "paid": {
                    "type": "integer",
                    "description": "Paid credits remaining"
                  }
                }
              }
            }
          }
        }
      },
      "User": {
        "type": "object",
        "description": "A team member account with connected email and/or LinkedIn sending capabilities.",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Unique user identifier"
          },
          "email": {
            "type": "string",
            "format": "email",
            "description": "User email address"
          },
          "role": {
            "type": "string",
            "description": "User role in the team (admin, member, etc.)"
          },
          "linkedIn": {
            "type": "object",
            "description": "LinkedIn integration settings",
            "properties": {
              "linkedinUrl": {
                "type": "string",
                "description": "The LinkedIn URL of the person"
              },
              "status": {
                "type": "boolean",
                "description": "Whether LinkedIn is connected"
              },
              "inviteLimit": {
                "type": "integer",
                "description": "Daily limit for LinkedIn connection invites"
              },
              "sendLimit": {
                "type": "integer",
                "description": "Daily limit for LinkedIn messages"
              },
              "visitLimit": {
                "type": "integer",
                "description": "Daily limit for LinkedIn profile visits"
              }
            }
          },
          "mailboxes": {
            "type": "array",
            "description": "Email mailboxes connected to this user",
            "items": {
              "$ref": "#/components/schemas/Mailbox"
            }
          }
        }
      },
      "Campaign": {
        "type": "object",
        "description": "An automated outreach workflow containing sequences of steps.",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Unique campaign identifier"
          },
          "name": {
            "type": "string",
            "description": "Campaign name"
          },
          "labels": {
            "type": "array",
            "description": "Categorization labels",
            "items": {
              "type": "string"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "Creation timestamp"
          },
          "createdBy": {
            "type": "string",
            "description": "Creator user ID"
          },
          "status": {
            "type": "string",
            "description": "Campaign status",
            "enum": [
              "running",
              "paused",
              "draft",
              "ended",
              "archived",
              "errors"
            ]
          },
          "sequenceId": {
            "type": "string",
            "description": "Main sequence ID"
          },
          "scheduleIds": {
            "type": "array",
            "description": "Associated schedule IDs",
            "items": {
              "type": "string"
            }
          },
          "teamId": {
            "type": "string",
            "description": "ID of the team that owns this campaign"
          },
          "hasError": {
            "type": "boolean",
            "description": "Whether the campaign has errors"
          },
          "errors": {
            "type": "array",
            "description": "List of error messages if campaign has errors",
            "items": {
              "type": "string"
            }
          },
          "creator": {
            "type": "object",
            "description": "Campaign creator information",
            "properties": {
              "userId": {
                "type": "string",
                "description": "Creator user ID"
              },
              "userEmail": {
                "type": "string",
                "format": "email",
                "description": "Creator email address"
              }
            }
          },
          "senders": {
            "type": "array",
            "description": "Campaign senders configuration",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Sender user ID"
                },
                "email": {
                  "type": "string",
                  "format": "email",
                  "description": "Sender email address"
                },
                "sendUserMailboxId": {
                  "type": "string",
                  "description": "Mailbox ID used for sending"
                }
              }
            }
          }
        }
      },
      "Lead": {
        "type": "object",
        "description": "A contact added to a campaign for outreach. Not to be confused with a contact which is a record in lemlist, but not necessarily added to a campaign.",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Unique lead identifier"
          },
          "email": {
            "type": "string",
            "format": "email",
            "description": "Lead email address"
          },
          "firstName": {
            "type": "string",
            "description": "First name"
          },
          "lastName": {
            "type": "string",
            "description": "Last name"
          },
          "companyName": {
            "type": "string",
            "description": "Company name"
          },
          "phone": {
            "type": "string",
            "description": "Phone number"
          },
          "linkedinUrl": {
            "type": "string",
            "format": "uri",
            "description": "LinkedIn profile URL"
          },
          "picture": {
            "type": "string",
            "format": "uri",
            "description": "Profile picture URL"
          },
          "icebreaker": {
            "type": "string",
            "description": "Personalized icebreaker text"
          },
          "timezone": {
            "type": "string",
            "description": "Lead's timezone in IANA format (e.g., Europe/Paris, America/New_York)"
          },
          "campaignId": {
            "type": "string",
            "description": "Campaign ID the lead belongs to"
          },
          "campaignName": {
            "type": "string",
            "description": "Campaign name the lead belongs to"
          },
          "isUnsubscribed": {
            "type": "boolean",
            "description": "Whether the lead is unsubscribed"
          }
        }
      },
      "Activity": {
        "type": "object",
        "description": "A recorded action or event in a campaign sequence (email sent, opened, clicked, etc.).",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Unique activity identifier"
          },
          "type": {
            "type": "string",
            "description": "Activity type (emailOpened, emailClicked, emailReplied, etc.)"
          },
          "leadId": {
            "type": "string",
            "description": "Associated lead ID"
          },
          "campaignId": {
            "type": "string",
            "description": "Campaign ID"
          },
          "sequenceId": {
            "type": "string",
            "description": "Sequence ID"
          },
          "stepId": {
            "type": "string",
            "description": "Step ID"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the activity occurred"
          }
        }
      },
      "Unsubscribe": {
        "type": "object",
        "description": "A record of someone opting out of receiving emails.",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Unique unsubscribe identifier"
          },
          "email": {
            "type": "string",
            "format": "email",
            "description": "Unsubscribed email address"
          },
          "campaignId": {
            "type": "string",
            "description": "Campaign ID from which the person unsubscribed"
          },
          "campaignName": {
            "type": "string",
            "description": "Campaign name from which the person unsubscribed"
          },
          "unsubscribedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Unsubscribe timestamp"
          },
          "scope": {
            "type": "string",
            "description": "Unsubscribe scope",
            "enum": [
              "campaign",
              "team",
              "global"
            ]
          }
        }
      },
      "UnsubscribedVariable": {
        "type": "object",
        "description": "A variable (email, domain, LinkedIn URL, or phone number) that has been unsubscribed.",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Unique identifier for the unsubscribe entry"
          },
          "value": {
            "type": "string",
            "description": "The unsubscribed variable (email, domain, LinkedIn URL, or phone number)"
          },
          "source": {
            "type": "string",
            "description": "Origin of the unsubscription",
            "enum": [
              "api",
              "bounced",
              "lead",
              "user",
              "abuse"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the variable was unsubscribed"
          }
        }
      },
      "ContactSubscriptionStatus": {
        "type": "object",
        "description": "Subscription status of a contact.",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Contact identifier"
          },
          "doNotContact": {
            "type": "boolean",
            "description": "Whether the contact is unsubscribed"
          }
        }
      },
      "Enrich": {
        "type": "object",
        "description": "Contact information discovered through data enrichment (emails, phone numbers, LinkedIn URLs).",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Unique enrichment request identifier"
          },
          "status": {
            "type": "string",
            "description": "Enrichment status",
            "enum": [
              "pending",
              "completed",
              "failed"
            ]
          },
          "email": {
            "type": "string",
            "format": "email",
            "description": "Found email address"
          },
          "phone": {
            "type": "string",
            "description": "Found phone number"
          },
          "firstName": {
            "type": "string",
            "description": "Found first name"
          },
          "lastName": {
            "type": "string",
            "description": "Found last name"
          },
          "companyName": {
            "type": "string",
            "description": "Found company name"
          },
          "linkedinUrl": {
            "type": "string",
            "format": "uri",
            "description": "Found LinkedIn URL"
          },
          "credits": {
            "type": "integer",
            "description": "Credits consumed"
          }
        }
      },
      "Task": {
        "type": "object",
        "description": "A manual action assigned to a user to complete.",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Unique task identifier"
          },
          "type": {
            "type": "string",
            "description": "Task type"
          },
          "leadId": {
            "type": "string",
            "description": "Associated lead ID"
          },
          "campaignId": {
            "type": "string",
            "description": "Campaign ID"
          },
          "userId": {
            "type": "string",
            "description": "Assigned user ID"
          },
          "status": {
            "type": "string",
            "description": "Task status",
            "enum": [
              "pending",
              "completed",
              "ignored"
            ]
          },
          "dueDate": {
            "type": "string",
            "format": "date-time",
            "description": "Due date timestamp"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "Creation timestamp"
          },
          "completedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Completion timestamp"
          }
        }
      },
      "Contact": {
        "type": "object",
        "description": "A contact record in your CRM. Not to be confused with a lead which is a contact specifically added to a campaign.",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Unique contact identifier"
          },
          "teamId": {
            "type": "string",
            "description": "Team identifier the contact belongs to"
          },
          "fullName": {
            "type": "string",
            "description": "Contact's calculated full name"
          },
          "email": {
            "type": "string",
            "format": "email",
            "description": "Contact's primary email address"
          },
          "fields": {
            "type": "object",
            "description": "Custom fields associated with the contact",
            "additionalProperties": true
          },
          "campaigns": {
            "type": "array",
            "description": "List of campaigns the contact is associated with",
            "items": {
              "type": "object",
              "properties": {
                "campaignId": {
                  "type": "string"
                },
                "campaignState": {
                  "type": "string"
                },
                "leadState": {
                  "type": "string"
                },
                "leadId": {
                  "type": "string"
                }
              }
            }
          },
          "ownerId": {
            "type": "string",
            "description": "ID of the user who owns this contact"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "Contact creation timestamp"
          },
          "createdBy": {
            "type": "string",
            "description": "ID of the user who created the contact"
          },
          "unsubscribed": {
            "type": "boolean",
            "description": "Whether the contact is globally unsubscribed. When true, no outreach will be sent to this contact."
          }
        }
      },
      "Company": {
        "type": "object",
        "description": "An organization record in your CRM.",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Unique company identifier"
          },
          "name": {
            "type": "string",
            "description": "Company name (may also be present under fields.name)"
          },
          "domain": {
            "type": "string",
            "description": "Website domain"
          },
          "industry": {
            "type": "string",
            "description": "Industry sector"
          },
          "size": {
            "type": "string",
            "description": "Company size"
          },
          "location": {
            "type": "string",
            "description": "Geographic location"
          },
          "fields": {
            "type": "object",
            "description": "Flexible key/value fields of the company (e.g., name, picture, industry, location, size, foundedOn)",
            "additionalProperties": true
          },
          "createdBy": {
            "type": "string",
            "description": "User ID who created the company"
          },
          "ownerId": {
            "type": "string",
            "description": "User ID of the owner of the company"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "Creation timestamp"
          },
          "crmSync": {
            "type": "object",
            "nullable": true,
            "description": "CRM sync status for the company, resolved against the team's active CRM provider (Hubspot, Salesforce, or Pipedrive). Only present when a CRM is connected. Use this block to monitor sync state and resolve duplicates (e.g. via `GET /companies?crmSyncStatus=unique_index_error_company`).",
            "properties": {
              "provider": {
                "type": "string",
                "enum": ["hubspot", "salesforce", "pipedrive"],
                "description": "Active CRM provider for the team."
              },
              "crmRecordId": {
                "type": "string",
                "nullable": true,
                "description": "Identifier of the company record on the CRM side. `null` when the lemlist company has not been synced yet."
              },
              "syncDisabled": {
                "type": "boolean",
                "description": "When `true`, automatic sync is paused for this company."
              },
              "errors": {
                "type": "array",
                "description": "List of recent sync errors. Empty when the company is synced cleanly.",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "description": "Coarse error category (e.g. `CONNECT_FAILED`, `CREATE_FAILED`, `UPDATE_FAILED`)."
                    },
                    "reason": {
                      "type": "string",
                      "description": "Specific error reason. Matches the lowercase form accepted by the `crmSyncStatus` query param (e.g. `UNIQUE_INDEX_ERROR_COMPANY`, `PROPERTY_DOESNT_EXIST`, `REQUIRED_FIELD_MISSING`)."
                    },
                    "raisedAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Timestamp when the error was last raised."
                    },
                    "metadata": {
                      "type": "object",
                      "additionalProperties": true,
                      "description": "Extra context. For `UNIQUE_INDEX_ERROR_COMPANY`, contains `alreadyExistingCompanyId` — the lemlist company that already occupies the conflicting CRM record. Use it to remap contacts onto the right lemlist company before deleting the duplicate."
                    }
                  }
                }
              }
            }
          }
        }
      },
      "DatabaseCompany": {
        "type": "object",
        "description": "A company record from lemlist's People database.",
        "properties": {
          "company_id": {
            "type": "integer",
            "description": "Unique company identifier"
          },
          "company_name": {
            "type": "string",
            "description": "Company name"
          },
          "company_website_url": {
            "type": "string",
            "description": "Website URL"
          },
          "company_employee_count": {
            "type": "integer",
            "description": "Employee count"
          },
          "company_industry": {
            "type": "string",
            "description": "Industry sector"
          }
        }
      },
      "CompanyNote": {
        "type": "object",
        "description": "A text note attached to a company record to store information.",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Unique note identifier"
          },
          "teamId": {
            "type": "string",
            "description": "Team ID that owns the company"
          },
          "companyId": {
            "type": "string",
            "description": "Parent company ID"
          },
          "note": {
            "type": "string",
            "description": "Note text content"
          },
          "type": {
            "type": "string",
            "description": "Type of note or activity (e.g., 'annotated')"
          },
          "userId": {
            "type": "string",
            "description": "ID of the user who created the note"
          },
          "sendUserId": {
            "type": "string",
            "description": "ID of the sending user if applicable"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "Creation timestamp"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Last update timestamp"
          }
        }
      },
      "Sequence": {
        "type": "object",
        "description": "An ordered series of steps within a campaign.",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Unique sequence identifier"
          },
          "campaignId": {
            "type": "string",
            "description": "Parent campaign ID"
          },
          "steps": {
            "type": "array",
            "description": "Ordered list of steps",
            "items": {
              "$ref": "#/components/schemas/Step"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "Creation timestamp"
          }
        }
      },
      "Step": {
        "type": "object",
        "description": "A single action in a sequence (email, LinkedIn message, delay, task, etc.).",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Unique step identifier"
          },
          "sequenceId": {
            "type": "string",
            "description": "Parent sequence ID"
          },
          "type": {
            "type": "string",
            "description": "Action type",
            "enum": [
              "email",
              "linkedinInvite",
              "linkedinMessage",
              "linkedinVisit",
              "delay",
              "task",
              "api"
            ]
          },
          "order": {
            "type": "integer",
            "description": "Position in sequence"
          },
          "delay": {
            "type": "integer",
            "description": "Wait days before execution"
          },
          "subject": {
            "type": "string",
            "description": "Email subject line"
          },
          "body": {
            "type": "string",
            "description": "Message content"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "Creation timestamp"
          }
        }
      },
      "Schedule": {
        "type": "object",
        "description": "Sending time windows defining when campaigns can send messages (days and hours).",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Unique schedule identifier"
          },
          "name": {
            "type": "string",
            "description": "Schedule name"
          },
          "secondsToWait": {
            "type": "integer",
            "description": "Seconds between sends"
          },
          "timezone": {
            "type": "string",
            "description": "Schedule timezone (e.g., 'Europe/Paris')"
          },
          "start": {
            "type": "string",
            "description": "Daily start time (HH:mm)",
            "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
          },
          "end": {
            "type": "string",
            "description": "Daily end time (HH:mm)",
            "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
          },
          "weekdays": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 7
            },
            "description": "Active weekdays (1=Monday, 7=Sunday)"
          },
          "public": {
            "type": "boolean",
            "description": "Whether the schedule is available as a template for other users"
          },
          "teamId": {
            "type": "string",
            "description": "Unique identifier of the team that owns this schedule"
          },
          "createdBy": {
            "type": "string",
            "description": "Unique identifier of the user who created this schedule"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the schedule was created"
          },
          "deletedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the schedule was deleted (only present if deleted)"
          },
          "deletedBy": {
            "type": "string",
            "description": "Unique identifier of the user who deleted this schedule (only present if deleted)"
          }
        }
      },
      "Webhook": {
        "type": "object",
        "description": "Webhooks send real-time HTTP notifications upon campaign events (opens, clicks, replies, etc.).",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Unique webhook identifier"
          },
          "targetUrl": {
            "type": "string",
            "format": "uri",
            "description": "Destination URL for event notifications"
          },
          "type": {
            "type": "string",
            "description": "Event type to listen for. Events are grouped by category — see the endpoint docs for a full breakdown.",
            "enum": [
              "contacted",
              "hooked",
              "attracted",
              "warmed",
              "interested",
              "notInterested",
              "emailsSent",
              "emailsOpened",
              "emailsClicked",
              "emailsReplied",
              "emailsBounced",
              "emailsFailed",
              "emailsInterested",
              "emailsNotInterested",
              "emailsUnsubscribed",
              "linkedinSent",
              "linkedinOpened",
              "linkedinReplied",
              "linkedinInterested",
              "linkedinNotInterested",
              "linkedinSendFailed",
              "linkedinVisitDone",
              "linkedinVisitFailed",
              "linkedinFollowDone",
              "linkedinFollowFailed",
              "linkedinFollowSkipped",
              "linkedinInviteDone",
              "linkedinInviteFailed",
              "linkedinInviteAccepted",
              "linkedinEndorseDone",
              "linkedinEndorseFailed",
              "linkedinEndorseSkipped",
              "linkedinVoiceNoteDone",
              "linkedinVoiceNoteFailed",
              "linkedinLikeLastPostDone",
              "linkedinLikeLastPostNoPost",
              "linkedinLikeLastPostFailed",
              "linkedinWithdrawInvitationDone",
              "linkedinWithdrawInvitationFailed",
              "whatsappMessageSent",
              "whatsappMessageDelivered",
              "whatsappMessageOpened",
              "whatsappReplied",
              "whatsappMessageFailed",
              "smsSent",
              "smsDelivered",
              "smsReplied",
              "smsFailed",
              "aircallCreated",
              "aircallEnded",
              "aircallDone",
              "aircallInterested",
              "aircallNotInterested",
              "apiDone",
              "apiInterested",
              "apiNotInterested",
              "apiFailed",
              "manualInterested",
              "manualNotInterested",
              "paused",
              "resumed",
              "stopped",
              "campaignComplete",
              "customDomainErrors",
              "connectionIssue",
              "sendLimitReached",
              "lemwarmPaused",
              "annotated",
              "enrichmentDone",
              "enrichmentError",
              "callRecordingDone",
              "callTranscriptDone",
              "inboxLabelUpdated",
              "signalRegistered",
              "deliverabilityAlertTriggered"
            ]
          },
          "campaignId": {
            "type": "string",
            "description": "The ID of the campaign the webhook is associated with (if any)"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "Creation timestamp"
          },
          "zapId": {
            "type": "integer",
            "description": "Zapier integration ID (if the destination is a Zapier webhook)"
          }
        }
      },
      "Report": {
        "type": "object",
        "description": "Aggregated campaign performance statistics (sent, opened, clicked, replied, etc.).",
        "properties": {
          "campaignId": {
            "type": "string",
            "description": "Campaign ID"
          },
          "campaignName": {
            "type": "string",
            "description": "Campaign name"
          },
          "stats": {
            "type": "object",
            "description": "Performance metrics",
            "properties": {
              "sent": {
                "type": "integer",
                "description": "Emails sent count"
              },
              "opened": {
                "type": "integer",
                "description": "Emails opened count"
              },
              "clicked": {
                "type": "integer",
                "description": "Links clicked count"
              },
              "replied": {
                "type": "integer",
                "description": "Replies received count"
              },
              "bounced": {
                "type": "integer",
                "description": "Bounced emails count"
              },
              "interested": {
                "type": "integer",
                "description": "Interested leads count"
              }
            }
          },
          "exportStatus": {
            "type": "string",
            "description": "Export request status",
            "enum": [
              "pending",
              "done",
              "error"
            ]
          }
        }
      },
      "Mailbox": {
        "type": "object",
        "description": "An email account connected to a user for sending campaigns.",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Unique mailbox identifier"
          },
          "email": {
            "type": "string",
            "format": "email",
            "description": "Mailbox email address"
          },
          "provider": {
            "type": "string",
            "description": "Email provider (google, microsoft, etc.)"
          },
          "status": {
            "type": "string",
            "description": "Connection status",
            "enum": [
              "CONNECTED",
              "ERROR",
              "DISCONNECTED"
            ]
          },
          "lemlist": {
            "type": "object",
            "properties": {
              "emailLimit": {
                "type": "integer",
                "description": "Daily send limit"
              }
            }
          },
          "lemwarm": {
            "type": "object",
            "properties": {
              "active": {
                "type": "boolean",
                "description": "Lemwarm activation status"
              }
            }
          }
        }
      },
      "ScheduleListResponse": {
        "type": "object",
        "description": "Paginated response containing multiple schedules.",
        "properties": {
          "schedules": {
            "type": "array",
            "description": "Array of schedule objects",
            "items": {
              "$ref": "#/components/schemas/Schedule"
            }
          },
          "pagination": {
            "type": "object",
            "description": "Pagination information",
            "properties": {
              "totalRecords": {
                "type": "integer",
                "description": "Total number of schedules across all pages"
              },
              "currentPage": {
                "type": "integer",
                "description": "Current page number"
              },
              "nextPage": {
                "type": "integer",
                "description": "Next page number (null if on last page)"
              },
              "totalPage": {
                "type": "integer",
                "description": "Total number of pages"
              }
            }
          }
        }
      },
      "LeadListResponse": {
        "type": "object",
        "description": "Paginated response containing multiple leads.",
        "properties": {
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Lead"
            }
          },
          "page": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          }
        }
      },
      "CrmFilter": {
        "type": "object",
        "description": "A filter used in the CRM to segment leads or companies.",
        "properties": {
          "_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "criteria": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "InboxConversation": {
        "type": "object",
        "description": "A message thread between a user and a contact in the inbox.",
        "properties": {
          "_id": {
            "type": "string"
          },
          "leadId": {
            "type": "string"
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InboxMessage"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "InboxConversationPagination": {
        "type": "object",
        "description": "Paginated response containing multiple inbox conversations.",
        "properties": {
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InboxConversation"
            }
          },
          "page": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          }
        }
      },
      "InboxMessage": {
        "type": "object",
        "description": "A single message within an inbox conversation.",
        "properties": {
          "_id": {
            "type": "string"
          },
          "conversationId": {
            "type": "string"
          },
          "sender": {
            "type": "string"
          },
          "recipient": {
            "type": "string"
          },
          "body": {
            "type": "string"
          },
          "sentAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "InboxMessagePagination": {
        "type": "object",
        "description": "Paginated response containing multiple inbox messages.",
        "properties": {
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InboxMessage"
            }
          },
          "page": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          }
        }
      },
      "Label": {
        "type": "object",
        "description": "A label used to categorize and organize inbox conversations.",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Unique label identifier"
          },
          "name": {
            "type": "string",
            "description": "Label name"
          },
          "color": {
            "type": "string",
            "description": "Hex color code for the label"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "Date and time when the label was created",
            "nullable": true
          },
          "createdBy": {
            "type": "string",
            "description": "Email of the user who created the label",
            "nullable": true
          }
        }
      },
      "TaskListResponse": {
        "type": "object",
        "description": "Paginated response containing multiple tasks.",
        "properties": {
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Task"
            }
          },
          "page": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          }
        }
      },
      "DatabaseFilter": {
        "type": "object",
        "description": "Saved search criteria for querying the People database.",
        "properties": {
          "_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "criteria": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "PeopleSchema": {
        "type": "object",
        "description": "A person record from lemlist's People database.",
        "additionalProperties": true,
        "properties": {
          "lead_id": {
            "type": "integer",
            "description": "Numeric identifier for the person in the People database"
          },
          "canonical_shorthand_name": {
            "type": "string"
          },
          "connections_count": {
            "type": "integer"
          },
          "country": {
            "type": "string"
          },
          "full_name": {
            "type": "string"
          },
          "education": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true,
              "properties": {
                "activities_and_societies": {
                  "type": "string"
                },
                "created": {
                  "type": "string"
                },
                "date_from": {
                  "type": "string"
                },
                "date_to": {
                  "type": "string"
                },
                "deleted": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                },
                "last_updated": {
                  "type": "string"
                },
                "member_id": {
                  "type": "string"
                },
                "school_url": {
                  "type": "string",
                  "format": "uri"
                },
                "subtitle": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                }
              }
            }
          },
          "experience_count": {
            "type": "integer"
          },
          "experiences": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true,
              "properties": {
                "company_id": {
                  "type": "integer"
                },
                "company_description": {
                  "type": "string"
                },
                "company_employee_count": {
                  "type": "integer"
                },
                "company_followers_count": {
                  "type": "integer"
                },
                "company_founded": {
                  "type": "integer"
                },
                "company_headquarters_city": {
                  "type": "string"
                },
                "company_headquarters_country": {
                  "type": "string"
                },
                "company_industry": {
                  "type": "string"
                },
                "company_linkedin_url": {
                  "type": "string",
                  "format": "uri"
                },
                "company_logo_url": {
                  "type": "string",
                  "format": "uri"
                },
                "company_name": {
                  "type": "string"
                },
                "company_size": {
                  "type": "string"
                },
                "company_type": {
                  "type": "string"
                },
                "company_url": {
                  "type": "string"
                },
                "company_website_url": {
                  "type": "string",
                  "format": "uri"
                },
                "revenue_bucket": {
                  "type": "string"
                },
                "company_domain": {
                  "type": "string"
                },
                "employees_count_growth": {
                  "type": "integer"
                },
                "last_funding_round_at": {
                  "type": "string"
                },
                "business_business_customer": {
                  "type": "string"
                },
                "current_exp_bucket": {
                  "type": "string"
                },
                "created": {
                  "type": "string"
                },
                "date_from": {
                  "type": "string"
                },
                "date_to": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "duration": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                },
                "last_updated": {
                  "type": "string"
                },
                "location": {
                  "type": "string"
                },
                "member_id": {
                  "type": "string"
                },
                "order_in_profile": {
                  "type": "integer"
                },
                "title": {
                  "type": "string"
                },
                "title_normalized": {
                  "type": "string"
                },
                "main_in_profile": {
                  "type": "boolean"
                }
              }
            }
          },
          "interests": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "interest": {
                  "type": "string"
                },
                "interest_id": {
                  "type": "string"
                }
              }
            }
          },
          "languages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "language": {
                  "type": "string"
                },
                "proficiency": {
                  "type": "string"
                }
              }
            }
          },
          "last_updated": {
            "type": "string"
          },
          "lead_industry": {
            "type": "string"
          },
          "lead_linkedin_url": {
            "type": "string",
            "format": "uri"
          },
          "lead_logo_url": {
            "type": "string",
            "format": "uri"
          },
          "linkedin_short": {
            "type": "string"
          },
          "location": {
            "type": "string"
          },
          "skills": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "skill": {
                  "type": "string"
                },
                "skill_id": {
                  "type": "string"
                }
              }
            }
          },
          "summary": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "lead_quality_score": {
            "type": "integer"
          },
          "seniority": {
            "type": "string"
          },
          "department": {
            "type": "string"
          },
          "connections_count_bucket": {
            "type": "string"
          },
          "years_of_exp_bucket": {
            "type": "string"
          },
          "current_exp_company_name": {
            "type": "string"
          },
          "geopoint": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "minItems": 2,
            "maxItems": 2
          },
          "_score": {
            "type": "number"
          },
          "_id": {
            "type": "string"
          }
        }
      },
      "CompaniesSchema": {
        "type": "object",
        "description": "A company record from lemlist's Companies database.",
        "additionalProperties": true,
        "properties": {
          "company_id": {
            "type": "string",
            "description": "Unique company identifier"
          },
          "company_website_url": {
            "type": "string",
            "format": "uri",
            "description": "Official company website URL"
          },
          "company_name": {
            "type": "string",
            "description": "Company name"
          },
          "company_linkedin_url": {
            "type": "string",
            "format": "uri",
            "description": "LinkedIn company profile URL"
          },
          "last_updated": {
            "type": "string",
            "description": "Last update timestamp (UTC)"
          },
          "company_headquarters_city": {
            "type": "string",
            "description": "Headquarters city"
          },
          "company_headquarters_country": {
            "type": "string",
            "description": "Headquarters country"
          },
          "company_logo_url": {
            "type": "string",
            "format": "uri",
            "description": "Company logo image URL"
          },
          "company_description": {
            "type": "string",
            "description": "Long company description"
          },
          "company_employee_count": {
            "type": "string",
            "description": "Employee count as string"
          },
          "company_type": {
            "type": "string",
            "description": "Company type (e.g., Privately Held, Public Company)"
          },
          "company_founded": {
            "type": "string",
            "description": "Year founded as string"
          },
          "company_followers_count": {
            "type": "string",
            "description": "LinkedIn followers count as string"
          },
          "company_size": {
            "type": "string",
            "description": "Company size bucket"
          },
          "revenue_bucket": {
            "type": "string",
            "description": "Revenue range bucket"
          },
          "company_domain": {
            "type": "string",
            "description": "Company web domain"
          },
          "employees_count_growth": {
            "type": "integer",
            "description": "Employee count growth number"
          },
          "last_funding_round_at": {
            "type": "string",
            "description": "Date of last funding round"
          },
          "techno_used_array": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Array of technologies used by the company"
          },
          "business_business_customer": {
            "type": "string",
            "description": "Customer type",
            "enum": [
              "B2B",
              "B2C",
              "B2B2C"
            ]
          },
          "company_quality_score": {
            "type": "string",
            "description": "Quality score as string"
          },
          "company_industry": {
            "type": "string",
            "description": "Primary industry"
          },
          "company_subindustry": {
            "type": "string",
            "description": "Sub-industry"
          },
          "company_subsubindustry": {
            "type": "string",
            "description": "Sub-sub-industry"
          },
          "company_location": {
            "type": "string",
            "description": "Full formatted location"
          },
          "company_location_geopoint_array": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "description": "Geopoint coordinates [longitude, latitude]"
          },
          "company_occ_lead": {
            "type": "string",
            "description": "Occupational lead count as string"
          },
          "_score": {
            "type": "number",
            "description": "Search relevance score"
          },
          "_id": {
            "type": "string",
            "description": "Internal document ID"
          }
        }
      },
      "LemwarmSettings": {
        "type": "object",
        "description": "Lemwarm configuration for a mailbox.",
        "properties": {
          "active": {
            "type": "boolean"
          },
          "dailyLimit": {
            "type": "integer"
          },
          "warmupTemplate": {
            "type": "string"
          },
          "deliverability": {
            "type": "object",
            "properties": {
              "score": {
                "type": "integer"
              },
              "lastAt": {
                "type": "string",
                "format": "date-time",
                "description": "Timestamp of last deliverability check"
              }
            }
          }
        }
      },
      "SignalSchema": {
        "type": "object",
        "description": "A signal detected by a Signal Agent representing a tracked event (hiring, LinkedIn activity, website visit, etc.)",
        "required": [
          "_id",
          "teamId",
          "watchListId",
          "type",
          "status",
          "receivedAt",
          "createdAt",
          "signalData"
        ],
        "properties": {
          "_id": {
            "type": "string",
            "description": "Unique signal identifier"
          },
          "teamId": {
            "type": "string",
            "description": "Team ID that owns this signal"
          },
          "watchListId": {
            "type": "string",
            "description": "ID of the Signal Agent associated with this signal"
          },
          "watchListName": {
            "type": "string",
            "description": "Name of the Signal Agent associated with this signal"
          },
          "type": {
            "type": "string",
            "description": "Signal type",
            "enum": [
              "companyIsHiring",
              "companyRaisedFunds",
              "jobChange",
              "newHire",
              "companyEmployeeVisitedMyWebsite",
              "linkedinProfile",
              "linkedinTopic"
            ]
          },
          "status": {
            "type": "string",
            "description": "Signal status (computed based on user actions)",
            "enum": [
              "new",
              "old",
              "handled",
              "ignored"
            ]
          },
          "receivedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the signal was received"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the signal was created in the database"
          },
          "contact": {
            "type": "object",
            "description": "Contact associated with this signal (if entity type is 'contact')",
            "properties": {
              "_id": {
                "type": "string",
                "description": "Contact ID"
              },
              "firstName": {
                "type": "string",
                "description": "Contact first name"
              },
              "lastName": {
                "type": "string",
                "description": "Contact last name"
              },
              "email": {
                "type": "string",
                "description": "Contact primary email"
              },
              "jobTitle": {
                "type": "string",
                "description": "Contact job title"
              },
              "phone": {
                "type": "string",
                "description": "Contact phone number"
              },
              "linkedinUrl": {
                "type": "string",
                "description": "Contact LinkedIn profile URL"
              },
              "picture": {
                "type": "string",
                "description": "Contact profile picture URL"
              }
            }
          },
          "company": {
            "type": "object",
            "description": "Company associated with this signal",
            "properties": {
              "_id": {
                "type": "string",
                "description": "Company ID"
              },
              "name": {
                "type": "string",
                "description": "Company name"
              },
              "domain": {
                "type": "string",
                "description": "Company website domain"
              },
              "linkedinUrl": {
                "type": "string",
                "description": "Company LinkedIn URL"
              },
              "industry": {
                "type": "string",
                "description": "Company industry"
              },
              "picture": {
                "type": "string",
                "description": "Company logo URL"
              }
            }
          },
          "signalData": {
            "type": "object",
            "description": "Signal-specific data that varies by signal type",
            "properties": {
              "jobTitle": {
                "type": "string",
                "description": "[companyIsHiring] Job posting title"
              },
              "jobDescription": {
                "type": "string",
                "description": "[companyIsHiring] Job posting description"
              },
              "jobLocation": {
                "type": "string",
                "description": "[companyIsHiring] Job posting location"
              },
              "jobUrl": {
                "type": "string",
                "description": "[companyIsHiring] Job posting URL"
              },
              "jobStatus": {
                "type": "string",
                "description": "[companyIsHiring] Job posting status"
              },
              "websiteVisited": {
                "type": "string",
                "description": "[companyEmployeeVisitedMyWebsite] Website URL that was visited"
              },
              "visitorWebsite": {
                "type": "string",
                "description": "[companyEmployeeVisitedMyWebsite] Visitor's company website"
              },
              "linkedinPostUrl": {
                "type": "string",
                "description": "[linkedinProfile/linkedinTopic] URL of the LinkedIn post"
              },
              "linkedinPostText": {
                "type": "string",
                "description": "[linkedinProfile/linkedinTopic] Text content of the LinkedIn post"
              },
              "linkedinReactionType": {
                "type": "string",
                "description": "[linkedinProfile/linkedinTopic] Type of LinkedIn reaction (like, comment, post)"
              },
              "linkedinReactedAt": {
                "type": "string",
                "format": "date-time",
                "description": "[linkedinProfile/linkedinTopic] When the LinkedIn reaction occurred"
              },
              "linkedinCommentText": {
                "type": "string",
                "description": "[linkedinProfile/linkedinTopic] Text of the LinkedIn comment"
              }
            }
          }
        }
      },
      "WatchListApiFetchSignalsResponse": {
        "type": "object",
        "description": "Paginated response containing signals detected by Signal Agents",
        "properties": {
          "signals": {
            "type": "array",
            "description": "Array of signals matching the query parameters",
            "items": {
              "$ref": "#/components/schemas/SignalSchema"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total number of signals matching the filter criteria"
          },
          "page": {
            "type": "integer",
            "description": "Current page number (if using page-based pagination)"
          },
          "offset": {
            "type": "integer",
            "description": "Current offset (if using offset-based pagination)"
          },
          "limit": {
            "type": "integer",
            "description": "Number of signals returned in this response"
          }
        }
      }
    }
  },
  "paths": {
    "/team": {
      "get": {
        "summary": "Get Team",
        "tags": [
          "Team"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "headers": {
              "Content-Type": {
                "schema": {
                  "type": "string"
                },
                "example": "application/json"
              }
            },
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Team"
                },
                "example": {
                  "_id": "tea_b4rMsi2trBhahaha",
                  "name": "lemlist",
                  "userIds": [
                    "usr_4YGm9ez7gMdyhahaha",
                    "usr_5GdFEgSLCN4hahaha",
                    "usr_F7iPChEQ3phahaha"
                  ],
                  "createdBy": "usr_4YGm9ez7gMdyhahaha",
                  "createdAt": "2018-02-22T08:52:30.926Z",
                  "hooks": [
                    {
                      "_id": "hoo_Ib5jfViX9hn3FzNqr",
                      "targetUrl": "https://hooks.zapier.com/hooks/standard/946357/*some-id*/",
                      "createdAt": "2018-06-05T09:07:07.761Z",
                      "zapId": 123456789,
                      "type": "emailsReplied",
                      "campaignId": "cam_TgyErJghahaha",
                      "isFirst": true
                    },
                    {
                      "_id": "hoo_SDRr2w4JigZDL7OB2",
                      "targetUrl": "https://hooks.zapier.com/hooks/standard/5078320/*some-other-id*/",
                      "createdAt": "2019-06-05T14:38:56.535Z",
                      "zapId": 987654321,
                      "type": "emailsReplied",
                      "campaignId": "cam_J2M3P9Z8whahaha"
                    },
                    {
                      "_id": "hoo_IYAPP4HnSyU7UTH3E",
                      "targetUrl": "https://hooks.zapier.com/hooks/standard/5078320/*some-id*/",
                      "createdAt": "2019-06-05T15:49:36.624Z",
                      "zapId": 59831776,
                      "type": "emailsReplied",
                      "campaignId": "cam_qBNYaIFXA77eXM1Ey",
                      "isFirst": true
                    },
                    {
                      "_id": "hoo_UAtwcPAd0tK9U6hKG",
                      "targetUrl": "https://subdomain.pipedream.net",
                      "createdAt": "2022-02-10T16:45:28.216Z",
                      "campaignId": "cam_7BE8IZRaqahU44Wp6"
                    }
                  ],
                  "slackWebhook": {
                    "url": "https://hooks.slack.com/services/T123456789/B123456789/*some-id*",
                    "failCounter": 1
                  },
                  "beta": [
                    "outreachQueue",
                    "crmSyncApiSalesforce",
                    "voipWhitelist",
                    "lemrich_postLemrichKafka",
                    "computedFieldActiveCampaigns"
                  ],
                  "pictureId": "fil_vRhMy09kT1Rv4Kq4O.png",
                  "invitedUsers": [
                    {
                      "email": "support@lemlist.com",
                      "role": "member",
                      "invitedBy": "usr_w7XoMXW37hahaha",
                      "invitedAt": "2023-03-04T20:06:29.585Z"
                    },
                    {
                      "email": "taylor@example.com",
                      "role": "admin",
                      "invitedBy": "usr_Hq4uzGvFP5q6homd",
                      "invitedAt": "2024-09-13T12:39:55.984Z"
                    }
                  ],
                  "agency": "usr_4YGm9ez7gMd2123456",
                  "customDomain": "custom.domain.com"
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: No API key provided / Bad team",
            "content": {
              "text/plain": {
                "example": "No API key provided"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "403": {
            "description": "User linked to this API key is blocked",
            "content": {
              "text/plain": {
                "example": "User linked to this API key is blocked"
              }
            }
          },
          "404": {
            "description": "No user found for this API key",
            "content": {
              "text/plain": {
                "example": "No user found for this API key"
              }
            }
          }
        }
      }
    },
    "/team/senders": {
      "get": {
        "summary": "Get Team Senders",
        "tags": [
          "Team"
        ],
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "Filter by campaign's state (running, paused, draft, ended, archived, errors)",
            "example": "running",
            "schema": {
              "type": "string",
              "enum": [
                "running",
                "paused",
                "draft",
                "ended",
                "archived",
                "errors"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "headers": {
              "Content-Type": {
                "schema": {
                  "type": "string"
                },
                "example": "application/json"
              }
            },
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "userId": {
                        "type": "string"
                      },
                      "campaigns": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string"
                            },
                            "sendingChannels": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "example": [
                  {
                    "userId": "usr_QB6kKK1wv68DujOET",
                    "campaigns": [
                      {
                        "_id": "cam_tBpHORyt3WhTQoi5A",
                        "name": "Onboarding",
                        "status": "paused",
                        "sendingChannels": [
                          "email",
                          "manual",
                          "linkedinVisit"
                        ]
                      },
                      {
                        "_id": "cam_O3BQOaXuyUuyqEHug",
                        "name": "Community Launch",
                        "status": "running",
                        "sendingChannels": [
                          "email",
                          "manual",
                          "linkedinVisit"
                        ]
                      },
                      {
                        "_id": "cam_NTJ1rituEQ61jVl6p",
                        "name": "Email Warmup Test",
                        "status": "ended",
                        "sendingChannels": [
                          "email",
                          "manual",
                          "linkedinVisit"
                        ]
                      },
                      {
                        "_id": "cam_1kESsVXFMzfrJImNc",
                        "name": "Product Launch Campaign",
                        "status": "draft",
                        "sendingChannels": [
                          "email",
                          "manual",
                          "linkedinVisit"
                        ]
                      }
                    ]
                  },
                  {
                    "userId": "usr_v5xz8De4nsLeNWAfv",
                    "campaigns": [
                      {
                        "_id": "cam_fDwCRnYtL1cfwcA7k",
                        "name": "WhatsApp Outreach",
                        "status": "draft",
                        "sendingChannels": [
                          "email",
                          "whatsappMessage"
                        ]
                      },
                      {
                        "_id": "cam_WBCWNrsoMKkCWWLqw",
                        "name": "WhatsApp Test Campaign",
                        "status": "ended",
                        "sendingChannels": [
                          "email",
                          "whatsappMessage"
                        ]
                      }
                    ]
                  },
                  {
                    "userId": "usr_rhhX1KT0qgOGCOrgE",
                    "campaigns": [
                      {
                        "_id": "cam_pCi08vhGoho2oK3YR",
                        "name": "Networking",
                        "status": "running",
                        "sendingChannels": [
                          "email",
                          "linkedinSend",
                          "linkedinVisit",
                          "linkedinInvite"
                        ]
                      },
                      {
                        "_id": "cam_zhcBovstiHVaV1abf",
                        "name": "Product Tools Campaign",
                        "status": "paused",
                        "sendingChannels": [
                          "email",
                          "linkedinSend",
                          "linkedinVisit",
                          "linkedinInvite"
                        ]
                      }
                    ]
                  }
                ]
              }
            }
          },
          "400": {
            "description": "Bad params (invalid state parameter)",
            "content": {
              "text/plain": {
                "example": "Bad params (invalid state parameter)"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/team/credits": {
      "get": {
        "summary": "Get Team Credits",
        "tags": [
          "Team"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "headers": {
              "Content-Type": {
                "schema": {
                  "type": "string"
                },
                "example": "application/json"
              }
            },
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Credits"
                },
                "example": {
                  "credits": 100,
                  "details": {
                    "remaining": {
                      "total": 100,
                      "freemium": 0,
                      "subscription": 80,
                      "gifted": 10,
                      "paid": 10
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "No API key provided",
            "content": {
              "text/plain": {
                "example": "No API key provided"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "403": {
            "description": "User linked to this API key is blocked",
            "content": {
              "text/plain": {
                "example": "User linked to this API key is blocked"
              }
            }
          },
          "404": {
            "description": "No user found for this API key",
            "content": {
              "text/plain": {
                "example": "No user found for this API key"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/team/crmUsers": {
      "get": {
        "summary": "Get Team CRM Users",
        "tags": [
          "Team"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "headers": {
              "Content-Type": {
                "schema": {
                  "type": "string"
                },
                "example": "application/json"
              }
            },
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "userId": {
                        "type": "string",
                        "description": "The lemlist ID of the user whose CRM account is integrated with lemlist"
                      },
                      "crm": {
                        "type": "string",
                        "description": "The CRM integrated with lemlist (e.g., salesforce, hubspot, pipedrive)"
                      }
                    }
                  }
                },
                "example": [
                  {
                    "userId": "usr_FU6yAd3UdBFel0UDy",
                    "crm": "salesforce"
                  },
                  {
                    "userId": "usr_FU6yAd3UdBFel0UDy",
                    "crm": "hubspot"
                  },
                  {
                    "userId": "usr_FU6yAd3UdBFel0UDy",
                    "crm": "pipedrive"
                  }
                ]
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / Endpoint not available",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          }
        }
      }
    },
    "/users/{userId}": {
      "parameters": [
        {
          "name": "userId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the user",
          "example": "usr_eSrHPSoL9QVPUOsho",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "summary": "Get User",
        "tags": [
          "Users"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "headers": {
              "Content-Type": {
                "schema": {
                  "type": "string"
                },
                "example": "application/json"
              }
            },
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/User"
                },
                "example": {
                  "_id": "usr_eSrHPSoL9QVPUOsho",
                  "email": "example@lemlist.co",
                  "role": "admin",
                  "linkedIn": {
                    "linkedinUrl": "https://www.linkedin.com/in/john-doe",
                    "status": true,
                    "inviteLimit": 25,
                    "sendLimit": 33,
                    "visitLimit": 36
                  },
                  "mailboxes": [
                    {
                      "_id": "usm_2mkqJNUjnJQiyVBht",
                      "email": "example@gmail.com",
                      "provider": "google",
                      "status": "ERROR",
                      "lemlist": {
                        "emailLimit": 50
                      },
                      "lemwarm": {
                        "active": false
                      }
                    },
                    {
                      "_id": "usm_gqlN3jKWoGo1Je8El",
                      "email": "example@outlook.com",
                      "status": "ERROR",
                      "lemlist": {
                        "emailLimit": 50
                      },
                      "lemwarm": {
                        "active": false
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / Endpoint not available",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          }
        }
      }
    },
    "/campaigns": {
      "get": {
        "summary": "Get Many Campaigns",
        "tags": [
          "Campaigns"
        ],
        "parameters": [
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Offset from the start. For pagination.",
            "example": "24",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Number of campaigns to retrieve. Default: 100. Maximum: 100.",
            "example": "2",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "version",
            "in": "query",
            "required": false,
            "description": "Set to 'v2' to use the latest version",
            "example": "v2",
            "schema": {
              "type": "string",
              "default": "v2",
              "enum": [
                "v2"
              ]
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number to retrieve",
            "example": "1",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "required": false,
            "description": "The field by which to sort. Currently, only 'createdAt' is supported.",
            "example": "createdAt",
            "schema": {
              "type": "string",
              "enum": [
                "createdAt"
              ]
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "required": false,
            "description": "The sort direction. Use 'desc' for descending order; any other value (or omission) will sort in ascending order.",
            "example": "desc",
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "The campaign status. Can be: running, draft, archived, ended, paused, errors. Note: a campaign can be in multiple statuses at one time (e.g., a paused campaign with errors).",
            "example": "running",
            "schema": {
              "type": "string",
              "enum": [
                "running",
                "draft",
                "archived",
                "ended",
                "paused",
                "errors"
              ]
            }
          },
          {
            "name": "createdBy",
            "in": "query",
            "required": false,
            "description": "Filter campaigns by creator user ID (usr_xxx format). Only returns campaigns created by the specified user.",
            "example": "usr_QG9E94KvTmC7KWqzs",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "headers": {
              "Content-Type": {
                "schema": {
                  "type": "string"
                },
                "example": "application/json"
              }
            },
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Campaign"
                  }
                },
                "example": [
                  {
                    "_id": "cam_4HrZbi8xsez4QlrnL",
                    "name": "Product Launch Campaign",
                    "labels": [],
                    "createdAt": "2025-02-20T14:45:54.230Z",
                    "createdBy": "usr_zdTCrNFyXblc4mrYK",
                    "status": "running",
                    "hasError": true,
                    "errors": [
                      "Your campaign does not have sender."
                    ]
                  },
                  {
                    "_id": "cam_k3gu2sa4KIfhRK34M",
                    "name": "Sales Outreach 2025",
                    "labels": [],
                    "createdAt": "2025-02-05T09:00:07.541Z",
                    "createdBy": "usr_UEvrOEP0CTAYEoFR4",
                    "status": "running",
                    "hasError": true,
                    "errors": [
                      "One of your sender has no email provider.",
                      "Your campaign have an invalid sender mailbox"
                    ]
                  },
                  {
                    "_id": "cam_HcFmYEhnCI39Pscan",
                    "name": "CRM Integration Test",
                    "labels": [
                      "CRM"
                    ],
                    "createdAt": "2023-01-27T14:58:52.482Z",
                    "createdBy": "usr_i52PiQtbq8SucjVTM",
                    "status": "running",
                    "hasError": true,
                    "errors": [
                      "One of your sender has no email provider.",
                      "Your campaign have an invalid sender mailbox"
                    ]
                  },
                  {
                    "_id": "cam_yZXeC6q3SXs3ha1FI",
                    "name": "Customer Onboarding",
                    "labels": [],
                    "createdAt": "2022-06-14T13:32:57.880Z",
                    "createdBy": "usr_i52PiQtbq8SucjVTM",
                    "status": "running"
                  }
                ]
              }
            }
          },
          "400": {
            "description": "No API key provided",
            "content": {
              "text/plain": {
                "example": "No API key provided"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "403": {
            "description": "User linked to this API key is blocked",
            "content": {
              "text/plain": {
                "example": "User linked to this API key is blocked"
              }
            }
          },
          "404": {
            "description": "No user found for this API key",
            "content": {
              "text/plain": {
                "example": "No user found for this API key"
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create Campaign",
        "tags": [
          "Campaigns"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "headers": {
              "Content-Type": {
                "schema": {
                  "type": "string"
                },
                "example": "application/json"
              }
            },
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string"
                    },
                    "sequenceId": {
                      "type": "string"
                    },
                    "scheduleIds": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "teamId": {
                      "type": "string"
                    },
                    "createdBy": {
                      "type": "string"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "state": {
                      "type": "string"
                    },
                    "scannedCount": {
                      "type": "integer"
                    },
                    "reviewedCount": {
                      "type": "integer"
                    },
                    "inSequenceLeadCount": {
                      "type": "integer"
                    },
                    "variableKeys": {
                      "type": "array",
                      "items": {}
                    },
                    "senders": {
                      "type": "array",
                      "items": {}
                    },
                    "sendUsers": {
                      "type": "array",
                      "items": {}
                    },
                    "displayedVariableKeys": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "emoji": {
                      "type": "string"
                    },
                    "stopOnEmailReplied": {
                      "type": "boolean"
                    },
                    "crmOpportunitiesOnTask": {
                      "type": "boolean"
                    },
                    "unsubscribe": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "crm": {
                      "type": "string"
                    },
                    "crmUserId": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "_id": "cam_kok3I33Sba7mcNIO7",
                  "sequenceId": "seq_ScVmFnlKdP6aVmyZN",
                  "scheduleIds": [
                    "skd_IrCdCoQ0ZUAEeUDwR"
                  ],
                  "teamId": "tea_edrkv2LgUK4Wf4ZzO",
                  "createdBy": "usr_Sy3xIhbEi7auHFv5A",
                  "createdAt": "2025-01-16T13:53:22.726Z",
                  "state": "running",
                  "scannedCount": 0,
                  "reviewedCount": 0,
                  "inSequenceLeadCount": 0,
                  "variableKeys": [],
                  "senders": [],
                  "sendUsers": [],
                  "displayedVariableKeys": [
                    "companyName"
                  ],
                  "emoji": "🚀",
                  "stopOnEmailReplied": true,
                  "crmOpportunitiesOnTask": true,
                  "unsubscribe": "campaign",
                  "name": "My new campaign",
                  "crm": "hubspot",
                  "crmUserId": "usr_0p9Q8ZyXSTNGpsHOe"
                }
              }
            }
          },
          "400": {
            "description": "No API key provided",
            "content": {
              "text/plain": {
                "example": "No API key provided"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "403": {
            "description": "User linked to this API key is blocked",
            "content": {
              "text/plain": {
                "example": "User linked to this API key is blocked"
              }
            }
          },
          "404": {
            "description": "No user found for this API key",
            "content": {
              "text/plain": {
                "example": "No user found for this API key"
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "The name of the campaign"
                  },
                  "timezone": {
                    "type": "string",
                    "description": "IANA timezone for the campaign schedule (e.g. `America/New_York`). Defaults to `Europe/Paris` if omitted."
                  },
                  "autoReview": {
                    "type": "boolean",
                    "description": "Automatically launch (review) leads as soon as they are added to the campaign, instead of requiring manual review. Defaults to `false`."
                  },
                  "autoReviewConditions": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": ["deliverable", "risky", "undeliverable", "unverified"]
                    },
                    "description": "Email deliverability statuses for which a lead is auto-launched when `autoReview` is enabled. Only leads whose email verification matches one of these statuses are launched automatically. Invalid values are rejected with a `400` error."
                  }
                },
                "required": [
                  "name"
                ]
              },
              "example": {
                "name": "My new campaign",
                "timezone": "America/New_York",
                "autoReview": true,
                "autoReviewConditions": ["deliverable", "risky"]
              }
            }
          }
        }
      }
    },
    "/campaigns/{campaignId}": {
      "parameters": [
        {
          "name": "campaignId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the campaign",
          "example": "cam_A1B2C3D4E5F6G7H8I9",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "summary": "Get Campaign",
        "tags": [
          "Campaigns"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "headers": {
              "Content-Type": {
                "schema": {
                  "type": "string"
                },
                "example": "application/json"
              }
            },
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Campaign"
                },
                "example": {
                  "_id": "cam_bSn8EORHQxbWPjHvu",
                  "name": "Product Launch Campaign",
                  "createdAt": "2025-10-27T07:01:04.058Z",
                  "status": "draft",
                  "creator": {
                    "userId": "usr_ahfFktBBHUIxbVG5P",
                    "userEmail": "support@lemlist.com"
                  },
                  "senders": [
                    {
                      "id": "usr_rhhX1KT0qgOGCOrgE",
                      "email": "support@lemlist.com",
                      "sendUserMailboxId": "usm_J7BzS86A1vRMc2AuB"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Campaign not found",
            "content": {
              "text/plain": {
                "example": "Campaign not found"
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Update Campaign",
        "tags": [
          "Campaigns"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "headers": {
              "Content-Type": {
                "schema": {
                  "type": "string"
                },
                "example": "application/json"
              }
            },
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "description": "The campaign name"
                    },
                    "stopOnEmailReplied": {
                      "type": "boolean",
                      "description": "Stop the campaign when a lead replies by email"
                    },
                    "stopOnMeetingBooked": {
                      "type": "boolean",
                      "description": "Stop the campaign when a meeting is booked"
                    },
                    "stopOnLinkClicked": {
                      "type": "boolean",
                      "description": "Stop the campaign when a link is clicked"
                    },
                    "leadsPausedByInterest": {
                      "type": "boolean",
                      "description": "Pause leads based on interest"
                    },
                    "opportunityReplied": {
                      "type": "boolean",
                      "description": "Create an opportunity when a lead replies"
                    },
                    "opportunityClicked": {
                      "type": "boolean",
                      "description": "Create an opportunity when a lead clicks a link"
                    },
                    "autoLeadInterest": {
                      "type": "boolean",
                      "description": "Automatically detect lead interest"
                    },
                    "disableTrackOpen": {
                      "type": "boolean",
                      "description": "Disable tracking of email opens"
                    },
                    "disableTrackClick": {
                      "type": "boolean",
                      "description": "Disable tracking of link clicks"
                    },
                    "disableTrackReply": {
                      "type": "boolean",
                      "description": "Disable tracking of email replies"
                    },
                    "disableOutOfOffice": {
                      "type": "boolean",
                      "description": "Disable out-of-office detection"
                    },
                    "sequenceSharing": {
                      "type": "boolean",
                      "description": "Enable sequence sharing for the campaign"
                    },
                    "stopOnLinkClickedFilter": {
                      "type": "string",
                      "description": "Filter for which link clicks should stop the campaign"
                    },
                    "sendUsers": {
                      "type": "array",
                      "description": "Configured senders for the campaign. Only present when sendUserIds was provided in the request. Senders that lack capabilities for any campaign sending channel are excluded.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "User ID of the sender"
                          },
                          "mailboxes": {
                            "type": "array",
                            "description": "Connected email mailboxes",
                            "items": {
                              "type": "object",
                              "properties": {
                                "sendUserMailboxId": {
                                  "type": "string"
                                },
                                "email": {
                                  "type": "string"
                                }
                              }
                            }
                          },
                          "phoneNumbers": {
                            "type": "array",
                            "description": "Connected phone numbers",
                            "items": {
                              "type": "string"
                            }
                          },
                          "whatsappAccountIds": {
                            "type": "array",
                            "description": "Connected WhatsApp account IDs",
                            "items": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "name": "New campaign name",
                  "stopOnEmailReplied": true,
                  "stopOnMeetingBooked": true,
                  "stopOnLinkClicked": false,
                  "leadsPausedByInterest": false,
                  "opportunityReplied": true,
                  "opportunityClicked": false,
                  "autoLeadInterest": true,
                  "disableTrackOpen": false,
                  "disableTrackClick": false,
                  "disableTrackReply": false,
                  "disableOutOfOffice": false,
                  "sequenceSharing": false,
                  "sendUsers": [
                    {
                      "id": "usr_2aBCdEfGHiJkLmNOp",
                      "mailboxes": [
                        {
                          "sendUserMailboxId": "smb_1aBcDeFgHiJkLmNoP",
                          "email": "john@acme.com"
                        }
                      ],
                      "phoneNumbers": [
                        "+15551234567"
                      ],
                      "whatsappAccountIds": [
                        "wha_3xYzAbCdEfGhIjKlM"
                      ]
                    },
                    {
                      "id": "usr_7xYzAbCdEfGhIjKlM",
                      "mailboxes": [
                        {
                          "sendUserMailboxId": "smb_9zYxWvUtSrQpOnMlK",
                          "email": "jane@acme.com"
                        }
                      ],
                      "phoneNumbers": [],
                      "whatsappAccountIds": []
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                },
                "examples": {
                  "badTeam": {
                    "summary": "Bad team",
                    "value": "Bad team"
                  },
                  "dynamicStrategy": {
                    "summary": "Cannot update senders for dynamic strategy campaigns",
                    "value": "Cannot update senders on campaigns with a dynamic sender strategy (contactOwner, leadImporter, customField)"
                  },
                  "noValidSenders": {
                    "summary": "No valid sender IDs",
                    "value": "None of the provided sender IDs are members of this team"
                  },
                  "noCapableSenders": {
                    "summary": "No senders with required capabilities",
                    "value": "None of the provided senders have the required capabilities for this campaign"
                  },
                  "missingChannels": {
                    "summary": "Campaign channels not covered",
                    "value": "The provided senders do not cover the following campaign channels: linkedin, sms"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Campaign not found",
            "content": {
              "text/plain": {
                "example": "Campaign not found"
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "The campaign name"
                  },
                  "stopOnEmailReplied": {
                    "type": "boolean",
                    "description": "Stop the campaign when a lead replies by email"
                  },
                  "stopOnMeetingBooked": {
                    "type": "boolean",
                    "description": "Stop the campaign when a meeting is booked"
                  },
                  "stopOnLinkClicked": {
                    "type": "boolean",
                    "description": "Stop the campaign when a link is clicked"
                  },
                  "leadsPausedByInterest": {
                    "type": "boolean",
                    "description": "Pause leads based on interest"
                  },
                  "opportunityReplied": {
                    "type": "boolean",
                    "description": "Create an opportunity when a lead replies"
                  },
                  "opportunityClicked": {
                    "type": "boolean",
                    "description": "Create an opportunity when a lead clicks a link"
                  },
                  "autoLeadInterest": {
                    "type": "boolean",
                    "description": "Automatically detect lead interest"
                  },
                  "disableTrackOpen": {
                    "type": "boolean",
                    "description": "Disable tracking of email opens"
                  },
                  "disableTrackClick": {
                    "type": "boolean",
                    "description": "Disable tracking of link clicks"
                  },
                  "disableTrackReply": {
                    "type": "boolean",
                    "description": "Disable tracking of email replies"
                  },
                  "disableOutOfOffice": {
                    "type": "boolean",
                    "description": "Disable out-of-office detection"
                  },
                  "sequenceSharing": {
                    "type": "boolean",
                    "description": "Enable sequence sharing for the campaign"
                  },
                  "stopOnLinkClickedFilter": {
                    "type": "string",
                    "description": "Filter for which link clicks should stop the campaign"
                  },
                  "sendUserIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Array of user IDs (usr_xxx format) to assign as campaign senders. Cannot be used on campaigns with a dynamic sender strategy (contactOwner, leadImporter, customField). Each sender is validated against the campaign's sending channels (email, LinkedIn, SMS, WhatsApp): senders without capabilities for at least one channel are excluded, and all channels must be covered by at least one sender."
                  },
                  "autoReview": {
                    "type": "boolean",
                    "description": "Automatically launch (review) leads as soon as they are added to the campaign, instead of requiring manual review."
                  },
                  "autoReviewConditions": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": ["deliverable", "risky", "undeliverable", "unverified"]
                    },
                    "description": "Email deliverability statuses for which a lead is auto-launched when `autoReview` is enabled. Only leads whose email verification matches one of these statuses are launched automatically. Invalid values are rejected with a `400` error."
                  },
                  "aiFeatures": {
                    "type": "object",
                    "description": "AI reply-handling settings. Provide only the flags to change; omitted flags keep their current value.",
                    "properties": {
                      "scoreReplies": {
                        "type": "boolean",
                        "description": "Enable AI reply scoring for this campaign."
                      },
                      "onInterestedReply": {
                        "type": "object",
                        "description": "AI action when a reply is detected as INTERESTED.",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "description": "Enable the interested-reply AI action."
                          },
                          "pauseAllCampaignsForLead": {
                            "type": "boolean",
                            "description": "Pause all campaigns for this lead."
                          },
                          "pauseCampaignForCompany": {
                            "type": "boolean",
                            "description": "Pause this campaign for other leads in the same company."
                          },
                          "pauseAllCampaignsForCompany": {
                            "type": "boolean",
                            "description": "Pause all campaigns for leads in the same company."
                          }
                        }
                      },
                      "onNotInterestedReply": {
                        "type": "object",
                        "description": "AI action when a reply is detected as NOT interested.",
                        "properties": {
                          "enabled": {
                            "type": "boolean",
                            "description": "Enable the not-interested-reply AI action."
                          },
                          "pauseAllCampaignsForLead": {
                            "type": "boolean",
                            "description": "Pause all campaigns for this lead."
                          },
                          "pauseCampaignForCompany": {
                            "type": "boolean",
                            "description": "Pause this campaign for other leads in the same company."
                          },
                          "pauseAllCampaignsForCompany": {
                            "type": "boolean",
                            "description": "Pause all campaigns for leads in the same company."
                          }
                        }
                      }
                    }
                  },
                  "tracking": {
                    "type": "object",
                    "description": "Open / click / reply tracking toggles.",
                    "properties": {
                      "trackOpens": {
                        "type": "boolean",
                        "description": "Whether email open tracking is enabled."
                      },
                      "trackClicks": {
                        "type": "boolean",
                        "description": "Whether link click tracking is enabled."
                      },
                      "trackReplies": {
                        "type": "boolean",
                        "description": "Whether reply tracking is enabled."
                      }
                    }
                  },
                  "onReplied": {
                    "type": "object",
                    "description": "Behavior when a lead replies.",
                    "properties": {
                      "createNewTask": {
                        "type": "boolean",
                        "description": "Create a task when a lead replies."
                      },
                      "campaignProgress": {
                        "type": "string",
                        "enum": ["continue", "pause", "stop"],
                        "description": "What happens to the lead on reply."
                      },
                      "propagateProgressToCompany": {
                        "type": "boolean",
                        "description": "Apply the same action to other leads in the same company."
                      },
                      "disableOutOfOffice": {
                        "type": "boolean",
                        "description": "Whether out-of-office detection is disabled."
                      }
                    }
                  },
                  "onLinkClicked": {
                    "type": "object",
                    "description": "Behavior when a lead clicks a tracked link.",
                    "properties": {
                      "createNewTask": {
                        "type": "boolean",
                        "description": "Create a task when a lead clicks a link."
                      },
                      "campaignProgress": {
                        "type": "string",
                        "enum": ["continue", "pause", "stop"],
                        "description": "What happens to the lead on link click."
                      },
                      "propagateProgressToCompany": {
                        "type": "boolean",
                        "description": "Apply the same action to other leads in the same company."
                      },
                      "specificLinks": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "description": "If non-empty, only these link URLs trigger the action (empty = all links)."
                      }
                    }
                  },
                  "onMeetingBooked": {
                    "type": "object",
                    "description": "Behavior when a meeting is booked.",
                    "properties": {
                      "campaignProgress": {
                        "type": "string",
                        "enum": ["continue", "pause", "stop"],
                        "description": "What happens to the lead when a meeting is booked."
                      },
                      "propagateProgressToCompany": {
                        "type": "boolean",
                        "description": "Apply the same action to other leads in the same company."
                      }
                    }
                  }
                }
              },
              "example": {
                "name": "New campaign name",
                "stopOnEmailReplied": true,
                "stopOnMeetingBooked": true,
                "stopOnLinkClicked": false,
                "leadsPausedByInterest": false,
                "opportunityReplied": true,
                "opportunityClicked": false,
                "autoLeadInterest": true,
                "disableTrackOpen": false,
                "disableTrackClick": false,
                "disableTrackReply": false,
                "disableOutOfOffice": false,
                "sequenceSharing": false,
                "sendUserIds": [
                  "usr_2aBCdEfGHiJkLmNOp",
                  "usr_7xYzAbCdEfGhIjKlM"
                ],
                "autoReview": true,
                "autoReviewConditions": ["deliverable", "risky"]
              }
            }
          }
        }
      }
    },
    "/campaigns/{campaignId}/pause": {
      "parameters": [
        {
          "name": "campaignId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the campaign",
          "example": "cam_A1B2C3D4E5F6G7H8I9",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "summary": "Pause Campaign",
        "tags": [
          "Campaigns"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "headers": {
              "Content-Type": {
                "schema": {
                  "type": "string"
                },
                "example": "application/json"
              }
            },
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string"
                    },
                    "state": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "_id": "cam_A1B2C3D4E5F6G7H8I9",
                  "state": "paused"
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Campaign not found",
            "content": {
              "text/plain": {
                "example": "Campaign not found"
              }
            }
          }
        }
      }
    },
    "/campaigns/{campaignId}/start": {
      "parameters": [
        {
          "name": "campaignId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the campaign",
          "example": "cam_A1B2C3D4E5F6G7H8I9",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "summary": "Start Campaign",
        "tags": [
          "Campaigns"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "headers": {
              "Content-Type": {
                "schema": {
                  "type": "string"
                },
                "example": "application/json"
              }
            },
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string"
                    },
                    "state": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "_id": "cam_A1B2C3D4E5F6G7H8I9",
                  "state": "running"
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Campaign not found",
            "content": {
              "text/plain": {
                "example": "Campaign not found"
              }
            }
          }
        }
      }
    },
    "/campaigns/{campaignId}/export/start": {
      "parameters": [
        {
          "name": "campaignId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the campaign to export",
          "example": "cam_A1B2C3D4E5F6G7H8I9",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "summary": "Start Campaign Stats Export",
        "description": "Start an asynchronous export of all campaign statistics. The final export result is a CSV file.",
        "tags": [
          "Campaigns"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Export started successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string",
                      "description": "The unique identifier of the export"
                    },
                    "id": {
                      "type": "string",
                      "description": "The unique identifier of the export (same as _id)"
                    },
                    "teamId": {
                      "type": "string",
                      "description": "The team identifier"
                    },
                    "campaignId": {
                      "type": "string",
                      "description": "The campaign identifier"
                    },
                    "campaignName": {
                      "type": "string",
                      "description": "The name of the campaign"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "done",
                        "error"
                      ],
                      "description": "Current status of the export"
                    },
                    "startedAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "When the export was started"
                    },
                    "progressIndex": {
                      "type": "integer",
                      "description": "Current progress index"
                    },
                    "progressTime": {
                      "type": "integer",
                      "description": "Timestamp of progress"
                    },
                    "progressLastStepDuration": {
                      "type": "integer",
                      "description": "Duration of last step in milliseconds"
                    },
                    "progressType": {
                      "type": "string",
                      "description": "Type of current progress step"
                    },
                    "progress": {
                      "type": "integer",
                      "description": "Number of items processed"
                    },
                    "total": {
                      "type": "integer",
                      "description": "Total number of items to process"
                    }
                  }
                },
                "example": {
                  "_id": "axp_Vv6lJOc8NlVVmDud5",
                  "id": "axp_Vv6lJOc8NlVVmDud5",
                  "teamId": "tea_c123fg5h8ijKL9noP",
                  "campaignId": "cam_A1B2C3D4E5F6G7H8I9",
                  "campaignName": "Insights Outreach 2024",
                  "status": "pending",
                  "startedAt": "2024-07-09T13:43:52.124Z",
                  "progressIndex": 0,
                  "progressTime": 1720532632124,
                  "progressLastStepDuration": 0,
                  "progressType": "starting",
                  "progress": 0,
                  "total": 0
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Campaign not found",
            "content": {
              "text/plain": {
                "example": "Campaign not found"
              }
            }
          }
        }
      }
    },
    "/campaigns/{campaignId}/export/{exportId}/status": {
      "parameters": [
        {
          "name": "campaignId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the campaign that was exported",
          "example": "cam_A1B2C3D4E5F6G7H8I9",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "exportId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the export returned by the /start endpoint",
          "example": "axp_Vv6lJOc8NlVVmDud5",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "summary": "Get Campaign Export Status",
        "description": "Check the status of an asynchronous campaign export.",
        "tags": [
          "Campaigns"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Export status retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string",
                          "description": "MongoDB identifier of the export"
                        },
                        "id": {
                          "type": "string",
                          "description": "The unique identifier of the export"
                        },
                        "teamId": {
                          "type": "string",
                          "description": "The team identifier"
                        },
                        "campaignId": {
                          "type": "string",
                          "description": "The campaign identifier"
                        },
                        "campaignName": {
                          "type": "string",
                          "description": "The name of the campaign"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "pending",
                            "done",
                            "error"
                          ],
                          "description": "Current status of the export"
                        },
                        "startedAt": {
                          "type": "string",
                          "format": "date-time",
                          "description": "When the export was started"
                        },
                        "endedAt": {
                          "type": "string",
                          "format": "date-time",
                          "description": "When the export finished (only present when done)"
                        },
                        "progressIndex": {
                          "type": "integer",
                          "description": "Current progress index"
                        },
                        "progressTime": {
                          "type": "integer",
                          "description": "Timestamp of progress"
                        },
                        "progressLastStepDuration": {
                          "type": "integer",
                          "description": "Duration of last step in milliseconds"
                        },
                        "progressType": {
                          "type": "string",
                          "description": "Type of current progress step"
                        },
                        "progress": {
                          "type": "integer",
                          "description": "Number of items processed"
                        },
                        "total": {
                          "type": "integer",
                          "description": "Total number of items to process"
                        },
                        "fileSize": {
                          "type": "integer",
                          "description": "Size of the exported CSV file in bytes (only present when done)"
                        },
                        "url": {
                          "type": "string",
                          "description": "Download URL for the CSV file (only present when status is done)"
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "done": {
                    "summary": "Export completed",
                    "value": {
                      "ok": true,
                      "status": {
                        "_id": "axp_eVuZ9rVr4yYWrnPWA",
                        "id": "axp_eVuZ9rVr4yYWrnPWA",
                        "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                        "campaignId": "cam_lBCWmqEWI399hJZOd",
                        "campaignName": "lemstage",
                        "status": "done",
                        "startedAt": "2025-10-27T07:53:16.267Z",
                        "progressIndex": 6,
                        "progressTime": 1761551597286,
                        "progressLastStepDuration": 0,
                        "progressType": "done",
                        "progress": 0,
                        "total": 0,
                        "fileSize": 23654,
                        "endedAt": "2025-10-27T07:53:17.286Z",
                        "url": "https://api.lemlist.com/api/files/exports/fil_axp_7guBefhehehe.csv"
                      }
                    }
                  },
                  "pending": {
                    "summary": "Export in progress",
                    "value": {
                      "ok": true,
                      "status": {
                        "id": "axp_Vv6lJOc8NlVVmDud5",
                        "teamId": "tea_c123fg5h8ijKL9noP",
                        "campaignId": "cam_A1B2C3D4E5F6G7H8I9",
                        "campaignName": "Insights Outreach 2024",
                        "status": "pending",
                        "startedAt": "2020-01-01T00:00:00.000Z",
                        "progressIndex": 3,
                        "progressTime": 1639138959979,
                        "progressLastStepDuration": 200,
                        "progressType": "processing",
                        "progress": 50,
                        "total": 100
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Campaign or export not found",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "ok": {
                          "type": "boolean"
                        },
                        "message": {
                          "type": "string"
                        }
                      }
                    },
                    {
                      "type": "string"
                    }
                  ]
                },
                "examples": {
                  "exportNotFound": {
                    "summary": "Export not found",
                    "value": {
                      "ok": false,
                      "message": "Export with id axp_DIoSPp9YM5EwWdyP0 not found"
                    }
                  },
                  "campaignNotFound": {
                    "summary": "Campaign not found",
                    "value": "Campaign not found"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/campaigns/{campaignId}/export/{exportId}/email/{email}": {
      "parameters": [
        {
          "name": "campaignId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the campaign that was exported",
          "example": "cam_A1B2C3D4E5F6G7H8I9",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "exportId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the export returned by the /start endpoint",
          "example": "axp_Vv6lJOc8NlVVmDud5",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "email",
          "in": "path",
          "required": true,
          "description": "The email address to send the export URL to when the export is done",
          "example": "emily.johnson@example.com",
          "schema": {
            "type": "string",
            "format": "email"
          }
        }
      ],
      "put": {
        "summary": "Set Email for Campaign Export Notification",
        "description": "Set an email address for a given export. When the export is done, an email with the download URL will be sent to the address provided.",
        "tags": [
          "Campaigns"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Email notification set successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string"
                        },
                        "id": {
                          "type": "string"
                        },
                        "teamId": {
                          "type": "string"
                        },
                        "campaignId": {
                          "type": "string"
                        },
                        "campaignName": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "pending",
                            "done",
                            "error"
                          ]
                        },
                        "startedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "progressIndex": {
                          "type": "integer"
                        },
                        "progressTime": {
                          "type": "integer"
                        },
                        "progressLastStepDuration": {
                          "type": "integer"
                        },
                        "progressType": {
                          "type": "string"
                        },
                        "progress": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "fileSize": {
                          "type": "integer",
                          "description": "Size of the export file in bytes"
                        },
                        "endedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "url": {
                          "type": "string",
                          "description": "Download URL for the CSV file"
                        },
                        "email": {
                          "type": "string",
                          "format": "email",
                          "description": "Email address that will receive the notification"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "status": {
                    "_id": "axp_Vv6lJOc8NlVVmDud5",
                    "id": "axp_Vv6lJOc8NlVVmDud5",
                    "teamId": "tea_c123fg5h8ijKL9noP",
                    "campaignId": "cam_A1B2C3D4E5F6G7H8I9",
                    "campaignName": "Insights Outreach 2024",
                    "status": "done",
                    "startedAt": "2024-07-11T09:49:15.278Z",
                    "progressIndex": 6,
                    "progressTime": 1720691355497,
                    "progressLastStepDuration": 0,
                    "progressType": "done",
                    "progress": 0,
                    "total": 0,
                    "fileSize": 654,
                    "endedAt": "2024-07-11T09:49:15.497Z",
                    "url": "https://api.lemlist.com/api/files/exports/fil_axp_Vv6lJOc8NlVVmDud5_insights_outreach_2024.csv",
                    "email": "emily.johnson@example.com"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Campaign or export not found",
            "content": {
              "text/plain": {
                "examples": {
                  "campaignNotFound": {
                    "summary": "Campaign not found",
                    "value": "Campaign not found"
                  },
                  "exportNotFound": {
                    "summary": "Export not found",
                    "value": "Export not found"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/campaigns/{campaignId}/export/leads": {
      "parameters": [
        {
          "name": "campaignId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the campaign",
          "example": "cam_A1B2C3D4E5F6G7H8I9",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "summary": "Export Campaign Leads",
        "description": "Export leads from a campaign with filtering options. Returns leads in CSV or JSON format based on their state (e.g., contacted, interested, replied, etc.).",
        "tags": [
          "Campaigns"
        ],
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "Filter to export only the specified lead's last states. Use 'all' to export all states. Can be a comma-separated list of states. **Global states**: imported, scanned, skipped, reviewed, contacted, hooked, attracted, warmed, interested, notInterested, emailsBounced, emailsUnsubscribed, failed, meetingBooked, paused. **Detailed states**: emailsSent, emailsOpened, emailsClicked, emailsReplied, emailsInterested, emailsNotInterested, emailsFailed, opportunitiesDone, aircallDone, aircallInterested, aircallNotInterested, apiDone, apiInterested, apiNotInterested, linkedinVisitDone, linkedinVisitFailed, linkedinInviteDone, linkedinInviteAccepted, linkedinInviteFailed, linkedinSent, linkedinOpened, linkedinReplied, linkedinInterested, linkedinNotInterested, linkedinSendFailed, manualInterested, manualNotInterested",
            "example": "all",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "imported",
                "scanned",
                "skipped",
                "reviewed",
                "contacted",
                "hooked",
                "attracted",
                "warmed",
                "interested",
                "notInterested",
                "emailsBounced",
                "emailsUnsubscribed",
                "failed",
                "meetingBooked",
                "paused",
                "emailsSent",
                "emailsOpened",
                "emailsClicked",
                "emailsReplied",
                "emailsInterested",
                "emailsNotInterested",
                "emailsFailed",
                "opportunitiesDone",
                "aircallDone",
                "aircallInterested",
                "aircallNotInterested",
                "apiDone",
                "apiInterested",
                "apiNotInterested",
                "linkedinVisitDone",
                "linkedinVisitFailed",
                "linkedinInviteDone",
                "linkedinInviteAccepted",
                "linkedinInviteFailed",
                "linkedinSent",
                "linkedinOpened",
                "linkedinReplied",
                "linkedinInterested",
                "linkedinNotInterested",
                "linkedinSendFailed",
                "manualInterested",
                "manualNotInterested"
              ],
              "default": "all"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "description": "Output format: 'json' or 'csv'. Default is CSV.",
            "example": "json",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "csv"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Leads exported successfully",
            "content": {
              "text/csv": {
                "example": "emailStatus,email,firstName,lastName,picture,phone,linkedinUrl,timezone,companyName,companyDomain,icebreaker,Original event page,url extension,event_link_to_send,testFieldToDelete,naissance,lastState,status,_id\n,jeremy@example.com,Jeremy,Smith,,,https://www.linkedin.com/in/jeremysmith,,example.com,,,https://www.example.com/event-registration,?name=Jeremy&email=jeremy@example.com,https://www.example.com/event-registration?name=Jeremy&email=jeremy@example.com,,,linkedinReplied,done,lea_s2cXajAHahdDKmDw8\n,frankie@example.org,Frankie,Johnson,,,https://www.linkedin.com/in/frankiejohnson,,example.org,,,https://www.example.com/event-registration,?name=Frankie&email=frankie@example.org,https://www.example.com/event-registration?name=Frankie&email=frankie@example.org,,,linkedinReplied,done,lea_E8hdds5NryDRXpGJa\n,louiza@example.io,Louiza,Brown,,,https://www.linkedin.com/in/louizabrown,,example.io,,,https://www.example.com/event-registration,?name=Louiza&email=louiza@example.io,https://www.example.com/event-registration?name=Louiza&email=louiza@example.io,,,emailsInterested,interested,lea_tLAI7Fr2gR5hVxAIc\n,benjamin@example.co,Benjamin,Williams,,,https://www.linkedin.com/in/benjaminwilliams,,example.co,,,https://www.example.com/event-registration,?name=Benjamin&email=benjamin@example.co,https://www.example.com/event-registration?name=Benjamin&email=benjamin@example.co,,,emailsUnsubscribed,unsubscribed,lea_oznzWQKKZGXrBdqXb\n,roxanne@example.net,Roxanne,Davis,,,https://www.linkedin.com/in/roxannedavis,,example.net,,,https://www.example.com/event-registration,?name=Roxanne&email=roxanne@example.net,https://www.example.com/event-registration?name=Roxanne&email=roxanne@example.net,,,emailsClicked,done,lea_M22nl3gUwvAiNl6Ks\n,thomas@example.fr,Thomas,Miller,,,https://www.linkedin.com/in/thomasmiller,,example.fr,,,https://www.example.com/event-registration,?name=Thomas&email=thomas@example.fr,https://www.example.com/event-registration?name=Thomas&email=thomas@example.fr,,,emailsSent,done,lea_z3DydraGgNBnLdV7o"
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "emailStatus": {
                        "type": "string",
                        "enum": [
                          "deliverable",
                          "risky",
                          "undeliverable"
                        ]
                      },
                      "email": {
                        "type": "string",
                        "format": "email"
                      },
                      "firstName": {
                        "type": "string"
                      },
                      "lastName": {
                        "type": "string"
                      },
                      "picture": {
                        "type": "string"
                      },
                      "phone": {
                        "type": "string"
                      },
                      "linkedinUrl": {
                        "type": "string"
                      },
                      "timezone": {
                        "type": "string"
                      },
                      "companyName": {
                        "type": "string"
                      },
                      "companyDomain": {
                        "type": "string"
                      },
                      "icebreaker": {
                        "type": "string"
                      },
                      "jobTitle": {
                        "type": "string"
                      },
                      "lastState": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string"
                      },
                      "_id": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Campaign not found",
            "content": {
              "text/plain": {
                "example": "Campaign not found"
              }
            }
          }
        }
      }
    },
    "/campaigns/reports": {
      "get": {
        "summary": "Get Campaign Reports",
        "description": "Retrieve reports for one or multiple campaigns. Returns aggregated statistics and export status for the specified campaigns.",
        "tags": [
          "Campaigns"
        ],
        "parameters": [
          {
            "name": "campaignIds",
            "in": "query",
            "required": true,
            "description": "Comma-separated list of campaign IDs to retrieve reports for",
            "example": "cam_A1B2C3D4E5F6G7H8I9,cam_B2C3D4E5F6G7H8I9J0",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Campaign reports retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string",
                        "description": "Campaign ID"
                      },
                      "name": {
                        "type": "string",
                        "description": "Campaign name"
                      },
                      "creator": {
                        "type": "string",
                        "description": "Creator user ID and email in format 'userId|email'"
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Campaign creation date"
                      },
                      "createdBy": {
                        "type": "string",
                        "description": "Name of the user who created the campaign"
                      },
                      "labels": {
                        "type": "string",
                        "description": "Campaign labels"
                      },
                      "totalCount": {
                        "type": "integer",
                        "description": "Total number of leads"
                      },
                      "reviewedCount": {
                        "type": "integer",
                        "description": "Number of reviewed leads"
                      },
                      "inSequenceLeadCount": {
                        "type": "integer",
                        "description": "Number of leads in sequence"
                      },
                      "state": {
                        "type": "string",
                        "description": "Campaign state (running, paused, etc.)"
                      },
                      "status": {
                        "type": "string",
                        "description": "Campaign status (draft, ended, etc.)"
                      },
                      "senderNames": {
                        "type": "string",
                        "description": "Comma-separated list of sender email addresses"
                      },
                      "sendersUsers": {
                        "type": "string",
                        "description": "Comma-separated list of sender names and emails"
                      },
                      "reviewed": {
                        "type": "integer",
                        "description": "Number of reviewed leads"
                      },
                      "emailsSent": {
                        "type": "integer",
                        "description": "Number of emails sent"
                      },
                      "emailsOpened": {
                        "type": "integer",
                        "description": "Number of emails opened"
                      },
                      "emailsClicked": {
                        "type": "integer",
                        "description": "Number of emails with links clicked"
                      },
                      "emailsReplied": {
                        "type": "integer",
                        "description": "Number of email replies received"
                      },
                      "emailsUnsubscribed": {
                        "type": "integer",
                        "description": "Number of unsubscribes via email"
                      },
                      "emailsInterested": {
                        "type": "integer",
                        "description": "Number of interested responses via email"
                      },
                      "linkedinSent": {
                        "type": "integer",
                        "description": "Number of LinkedIn messages sent"
                      },
                      "linkedinOpened": {
                        "type": "integer",
                        "description": "Number of LinkedIn messages opened"
                      },
                      "linkedinReplied": {
                        "type": "integer",
                        "description": "Number of LinkedIn replies received"
                      },
                      "interested": {
                        "type": "integer",
                        "description": "Total number of interested leads"
                      },
                      "notInterested": {
                        "type": "integer",
                        "description": "Total number of not interested leads"
                      }
                    }
                  }
                },
                "example": [
                  {
                    "_id": "cam_bSn8EORHQxbWPjHvu",
                    "name": "Product Launch Campaign",
                    "creator": "usr_ahfFktBBHUIxbVG5P|user@example.com",
                    "createdAt": "2025-10-27T07:01:04.058Z",
                    "createdBy": "John Smith",
                    "labels": "",
                    "totalCount": 0,
                    "reviewedCount": 0,
                    "inSequenceLeadCount": 0,
                    "state": "running",
                    "status": "draft",
                    "senderNames": "sender@example.com",
                    "sendersUsers": "Jane Doe:sender@example.com",
                    "reviewed": 0,
                    "emailsSent": 0,
                    "emailsOpened": 0,
                    "emailsClicked": 0,
                    "emailsReplied": 0,
                    "emailsInterested": 0,
                    "linkedinSent": 0,
                    "linkedinReplied": 0,
                    "interested": 0,
                    "notInterested": 0
                  },
                  {
                    "_id": "cam_lBCWmqEWI399hJZOd",
                    "name": "Event Outreach Campaign",
                    "creator": "usr_QHeXD2DttUIlvWT9V|admin@example.co",
                    "createdAt": "2022-11-09T16:41:03.538Z",
                    "createdBy": "Sarah Johnson",
                    "labels": "",
                    "totalCount": 0,
                    "reviewedCount": 32,
                    "inSequenceLeadCount": 32,
                    "state": "paused",
                    "status": "ended",
                    "senderNames": "",
                    "sendersUsers": "",
                    "reviewed": 0,
                    "emailsSent": 20,
                    "emailsOpened": 18,
                    "emailsClicked": 4,
                    "emailsReplied": 1,
                    "emailsUnsubscribed": 1,
                    "emailsInterested": 1,
                    "linkedinSent": 32,
                    "linkedinOpened": 15,
                    "linkedinReplied": 15,
                    "interested": 0,
                    "notInterested": 0
                  }
                ]
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/campaigns/{campaignId}/sequences": {
      "parameters": [
        {
          "name": "campaignId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the campaign",
          "example": "cam_A1B2C3D4E5F6G7H8I9",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "summary": "Get Campaign Sequences",
        "tags": [
          "Sequences"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "headers": {
              "Content-Type": {
                "schema": {
                  "type": "string"
                },
                "example": "application/json"
              }
            },
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Object where each key is a sequence ID and each value is a sequence object",
                  "additionalProperties": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string",
                        "description": "The unique identifier of the sequence"
                      },
                      "steps": {
                        "type": "array",
                        "description": "Array of steps in the sequence",
                        "items": {
                          "type": "object",
                          "properties": {
                            "_id": {
                              "type": "string",
                              "description": "The unique identifier of the step"
                            },
                            "delay": {
                              "type": "integer",
                              "description": "The delay in days before executing this step"
                            },
                            "emailTemplateId": {
                              "type": "string",
                              "description": "The unique identifier of the email template used for this step"
                            },
                            "type": {
                              "type": "string",
                              "description": "The type of step (e.g., email, linkedinSend, linkedinInvite, conditional)"
                            },
                            "index": {
                              "type": "integer",
                              "description": "The position of the step in the sequence"
                            },
                            "sequenceId": {
                              "type": "string",
                              "description": "The unique identifier of the parent sequence"
                            },
                            "sequenceStep": {
                              "type": "integer",
                              "description": "The step number in the sequence"
                            },
                            "message": {
                              "type": "string",
                              "description": "The message content for the step (plain text for LinkedIn, HTML for email)"
                            },
                            "subject": {
                              "type": "string",
                              "description": "The email subject line (only for email steps)"
                            }
                          }
                        }
                      },
                      "level": {
                        "type": "integer",
                        "description": "The nesting level of the sequence (0 for main sequence, 1+ for nested conditional sequences)"
                      },
                      "parentId": {
                        "type": "string",
                        "description": "The unique identifier of the parent sequence (only for conditional sequences)"
                      },
                      "conditionalStepIndex": {
                        "type": "integer",
                        "description": "The index of the conditional step that triggers this sequence (only for conditional sequences)"
                      }
                    }
                  }
                },
                "example": {
                  "seq_rH5RD3fMkkt2gM3YC": {
                    "_id": "seq_rH5RD3fMkkt2gM3YC",
                    "steps": [
                      {
                        "_id": "stp_sFUj6keaSz9wr049M",
                        "delay": 0,
                        "emailTemplateId": "etp_ahlbc2yafFyu728H8",
                        "type": "linkedinSend",
                        "index": 1,
                        "sequenceId": "seq_rH5RD3fMkkt2gM3YC",
                        "sequenceStep": 0,
                        "message": "Hey {{firstName}}, \n\nwe're launching an event, a place where people can regularly meet, network, and learn from each other. We would love it if you could join us for a drink & chat next week. What do you say? 😊"
                      },
                      {
                        "_id": "stp_qsTl0LO6zkQQJQqsP",
                        "delay": 1,
                        "emailTemplateId": "etp_HFjUGtyDxIOxgZYcG",
                        "index": 2,
                        "sequenceId": "seq_rH5RD3fMkkt2gM3YC",
                        "sequenceStep": 1,
                        "subject": "{{firstName}}, do we count on you for the event?",
                        "message": "<p style=\"margin: 0px; box-sizing: border-box;\">Hey {{firstName}},<br style=\"box-sizing: border-box;\"><br style=\"box-sizing: border-box;\"></p>\n<p style=\"margin: 0px; box-sizing: border-box;\">Do you have any plans for Thursday, 7pm?<br style=\"box-sizing: border-box;\"><br style=\"box-sizing: border-box;\"></p>\n<p style=\"margin: 0px; box-sizing: border-box;\">What about spending the evening with cool people by our office?<br style=\"box-sizing: border-box;\"><br style=\"box-sizing: border-box;\"></p>\n<p style=\"margin: 0px; box-sizing: border-box;\">We're launching an event, a place where people can regularly meet, network, and build connections that help them grow further 😊<br style=\"box-sizing: border-box;\"><br style=\"box-sizing: border-box;\"></p>\n<p style=\"margin: 0px; box-sizing: border-box;\">It would be really nice if we could count on you for the event-&nbsp;<a target=\"_blank\" style=\"color: rgb(0, 123, 255); text-decoration: none; background-color: transparent; user-select: auto; box-sizing: border-box;\" rel=\"noopener noreferrer\" href=\"{{event_link_to_send}}\">here's your invite</a>&nbsp;🔥</p><p style=\"margin: 0px; box-sizing: border-box;\"><br style=\"box-sizing: border-box;\"></p>\n<p style=\"margin: 0px; box-sizing: border-box;\">Can you make it?<br style=\"box-sizing: border-box;\"><br style=\"box-sizing: border-box;\"></p>\n<p style=\"margin: 0px; box-sizing: border-box;\">Sarah,</p><p style=\"margin: 0px; box-sizing: border-box;\">Head of Marketing</p>",
                        "type": "email"
                      },
                      {
                        "_id": "stp_pRcXzJDmOrBkFtNc3",
                        "delay": 1,
                        "emailTemplateId": "etp_3tjFTgdOMS6JL8U1g",
                        "index": 3,
                        "sequenceId": "seq_rH5RD3fMkkt2gM3YC",
                        "sequenceStep": 2,
                        "subject": "{{firstName}}, do we count on you for the event?",
                        "message": "<p style=\"margin: 0px; box-sizing: border-box;\">So, should I add you to the list of attendees?<br style=\"box-sizing: border-box;\"><br style=\"box-sizing: border-box;\"></p>\n<p style=\"margin: 0px; box-sizing: border-box;\">We'll meet around 7pm, have a drink and exchange with entrepreneurs, marketers, and salespeople.<br style=\"box-sizing: border-box;\"><br style=\"box-sizing: border-box;\"></p>\n<p style=\"margin: 0px; box-sizing: border-box;\"><a target=\"_blank\" style=\"color: rgb(0, 123, 255); text-decoration: none; background-color: transparent; user-select: auto; box-sizing: border-box;\" rel=\"noopener noreferrer\" href=\"{{event_link_to_send}}\">Here's the link</a> if you want to join!<br style=\"box-sizing: border-box;\"><br style=\"box-sizing: border-box;\"></p>\n<p style=\"margin: 0px; box-sizing: border-box;\">We would love to have you with us for this event!<br style=\"box-sizing: border-box;\"><br style=\"box-sizing: border-box;\">Sarah</p><p style=\"margin: 0px; box-sizing: border-box;\">Head of Marketing</p>",
                        "type": "email"
                      }
                    ],
                    "level": 0
                  }
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / Campaign has no sequence",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "404": {
            "description": "Campaign not found",
            "content": {
              "text/plain": {
                "example": "Campaign not found"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/sequences/{sequenceId}/steps": {
      "parameters": [
        {
          "name": "sequenceId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the sequence",
          "example": "seq_lkCSKd32qSZZTe5Ru",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "summary": "Add Step to Sequence",
        "tags": [
          "Sequences"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "headers": {
              "Content-Type": {
                "schema": {
                  "type": "string"
                },
                "example": "application/json"
              }
            },
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    },
                    "delay": {
                      "type": "integer"
                    },
                    "emailTemplateId": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "_id": "stp_V0JHmSpWiO0rxHUkz",
                  "type": "linkedinInvite",
                  "delay": 2,
                  "emailTemplateId": "etp_sw6csWaZNwnfdwGZ6",
                  "message": "Hello, I would like..."
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / Error from createStep",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "description": "The type of step to create",
                    "enum": [
                      "email",
                      "manual",
                      "phone",
                      "api",
                      "linkedinVisit",
                      "linkedinInvite",
                      "linkedinSend",
                      "linkedinVoiceNote",
                      "linkedinFollow",
                      "linkedinLikeLastPost",
                      "linkedinCommentLastPost",
                      "linkedinEndorse",
                      "linkedinWithdrawInvitation",
                      "sendToAnotherCampaign",
                      "conditional",
                      "whatsappMessage",
                      "sms"
                    ]
                  },
                  "index": {
                    "type": "integer",
                    "description": "The position within the sequence to insert the new step (≥ -1). If omitted or greater than the number of steps, the new step is added to the end"
                  },
                  "delay": {
                    "type": "integer",
                    "description": "Delay in days before executing this step. Defaults to 0 for the first step and 1 for subsequent steps"
                  },
                  "subject": {
                    "type": "string",
                    "description": "Email subject line (required for email steps)"
                  },
                  "message": {
                    "type": "string",
                    "description": "Content of the email or message (used for email, linkedinInvite, linkedinSend, manual, phone, whatsappMessage, sms steps). Required for linkedinSend, whatsappMessage, and sms"
                  },
                  "altMessage": {
                    "type": "string",
                    "description": "Alternate message for linkedinSend steps"
                  },
                  "title": {
                    "type": "string",
                    "description": "Title or label for manual steps"
                  },
                  "method": {
                    "type": "string",
                    "description": "HTTP method for API steps",
                    "enum": [
                      "GET",
                      "POST",
                      "PUT",
                      "DELETE",
                      "PATCH"
                    ]
                  },
                  "url": {
                    "type": "string",
                    "description": "URL of the API endpoint to call (required for api steps). Must start with http:// or https://"
                  },
                  "conditionKey": {
                    "type": "string",
                    "description": "Condition key for conditional steps",
                    "enum": [
                      "hasEmailAddress",
                      "hasLinkedinUrl",
                      "hasPhoneNumber",
                      "hasScore",
                      "emailsOpened",
                      "emailsClicked",
                      "emailsUnsubscribed",
                      "meetingBooked",
                      "linkedinInviteAccepted",
                      "linkedinOpened",
                      "aircallDone",
                      "linkedinNetworkCheck",
                      "hasWhatsappAccount"
                    ]
                  },
                  "delayType": {
                    "type": "string",
                    "description": "Delay type for conditional steps",
                    "enum": [
                      "within",
                      "waitUntil"
                    ]
                  },
                  "campaignId": {
                    "type": "string",
                    "description": "Target campaign ID for sendToAnotherCampaign steps. The campaign must exist and not be archived"
                  },
                  "images": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uri"
                    },
                    "description": "Public HTTPS URLs of images to attach to a `linkedinInvite` or `linkedinSend` step. lemlist downloads each file and re-hosts it. Allowed MIME types: `image/png`, `image/jpeg`, `image/gif`. Up to 20 MB per file, and up to 6 items total combined with `videos`."
                  },
                  "videos": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uri"
                    },
                    "description": "Public HTTPS URLs of videos to attach to a `linkedinInvite` or `linkedinSend` step. lemlist downloads each file and re-hosts it. Allowed MIME types: `video/mp4`, `video/quicktime`. Up to 20 MB per file, and up to 6 items total combined with `images`."
                  },
                  "skillName": {
                    "type": "string",
                    "description": "Name of the LinkedIn skill to endorse on the lead's profile. Applies to `linkedinEndorse` steps only."
                  },
                  "endorseAnyFallback": {
                    "type": "boolean",
                    "description": "Applies to `linkedinEndorse` steps only. When `true` and the named skill is not on the lead's profile, lemlist falls back to endorsing any available skill."
                  },
                  "recordMode": {
                    "type": "string",
                    "description": "Applies to `linkedinVoiceNote` steps only. Determines how the audio is sourced. `manual` (default) means the user records the audio themselves from the lemlist UI after step creation; `ai` means lemlist generates the audio from a text template provided in the lemlist UI.",
                    "enum": [
                      "manual",
                      "ai"
                    ]
                  }
                }
              },
              "examples": {
                "Email Step": {
                  "value": {
                    "type": "email",
                    "subject": "{{firstName}}, quick question about {{companyName}}",
                    "message": "<p>Hi {{firstName}},</p><p>I noticed {{companyName}} is working on improving customer engagement. Would you be interested in discussing how we can help?</p><p>Best regards,<br>{{senderName}}</p>",
                    "delay": 1,
                    "index": 2
                  }
                },
                "LinkedIn Invite": {
                  "value": {
                    "type": "linkedinInvite",
                    "message": "Hi {{firstName}}, I'd love to connect and learn more about your work at {{companyName}}!",
                    "delay": 0
                  }
                },
                "LinkedIn Send": {
                  "value": {
                    "type": "linkedinSend",
                    "message": "Hey {{firstName}}, thanks for connecting! I wanted to reach out about...",
                    "delay": 2
                  }
                },
                "LinkedIn Send with Media": {
                  "value": {
                    "type": "linkedinSend",
                    "message": "Hey {{firstName}}, sharing a quick overview of what we're building.",
                    "images": [
                      "https://example.com/assets/overview.png"
                    ],
                    "videos": [
                      "https://example.com/assets/demo.mp4"
                    ],
                    "delay": 2
                  }
                },
                "Manual Task": {
                  "value": {
                    "type": "manual",
                    "title": "Call prospect",
                    "message": "Discuss their pain points and schedule a demo",
                    "delay": 1
                  }
                },
                "Phone Call": {
                  "value": {
                    "type": "phone",
                    "message": "Follow up on the email sent yesterday",
                    "delay": 1
                  }
                },
                "API Call": {
                  "value": {
                    "type": "api",
                    "method": "POST",
                    "url": "https://api.example.com/webhook",
                    "delay": 0
                  }
                },
                "LinkedIn Visit": {
                  "value": {
                    "type": "linkedinVisit",
                    "delay": 0
                  }
                },
                "Conditional Step": {
                  "value": {
                    "type": "conditional",
                    "conditionKey": "linkedinInviteAccepted",
                    "delayType": "waitUntil",
                    "delay": 1
                  }
                },
                "Send to Another Campaign": {
                  "value": {
                    "type": "sendToAnotherCampaign",
                    "campaignId": "cam_ABC123XYZ456",
                    "delay": 0
                  }
                },
                "WhatsApp Message": {
                  "value": {
                    "type": "whatsappMessage",
                    "message": "Hi {{firstName}}, following up on our conversation...",
                    "delay": 1
                  }
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{sequenceId}/steps/{stepId}": {
      "parameters": [
        {
          "name": "sequenceId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the sequence",
          "example": "seq_lkCSKd32qSZZTe5Ru",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "stepId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the step",
          "example": "stp_V0JHmSpWiO0rxHUkz",
          "schema": {
            "type": "string"
          }
        }
      ],
      "patch": {
        "summary": "Update Sequence Step",
        "tags": [
          "Sequences"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "headers": {
              "Content-Type": {
                "schema": {
                  "type": "string"
                },
                "example": "application/json"
              }
            },
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    },
                    "delay": {
                      "type": "integer"
                    },
                    "emailTemplateId": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "_id": "stp_V0JHmSpWiO0rxHUkz",
                  "type": "linkedinInvite",
                  "delay": 0,
                  "emailTemplateId": "etp_HZvLoLNEwdJ8Vu0w7",
                  "message": "Hello, I want to..."
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / Error from updateStep",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "description": "The type of step (required but cannot be changed - must match the existing step type)",
                    "enum": [
                      "email",
                      "manual",
                      "phone",
                      "api",
                      "linkedinVisit",
                      "linkedinInvite",
                      "linkedinSend",
                      "linkedinVoiceNote",
                      "linkedinFollow",
                      "linkedinLikeLastPost",
                      "linkedinCommentLastPost",
                      "linkedinEndorse",
                      "linkedinWithdrawInvitation",
                      "sendToAnotherCampaign",
                      "conditional",
                      "whatsappMessage",
                      "sms"
                    ]
                  },
                  "delay": {
                    "type": "integer",
                    "description": "Delay in days before executing this step"
                  },
                  "subject": {
                    "type": "string",
                    "description": "Email subject line (for email steps)"
                  },
                  "message": {
                    "type": "string",
                    "description": "Content of the email or message (for email, linkedinInvite, linkedinSend, manual, phone, whatsappMessage, sms steps)"
                  },
                  "altMessage": {
                    "type": "string",
                    "description": "Alternate message for linkedinSend steps"
                  },
                  "title": {
                    "type": "string",
                    "description": "Title or label for manual steps"
                  },
                  "method": {
                    "type": "string",
                    "description": "HTTP method for API steps",
                    "enum": [
                      "GET",
                      "POST",
                      "PUT",
                      "DELETE",
                      "PATCH"
                    ]
                  },
                  "url": {
                    "type": "string",
                    "description": "URL of the API endpoint to call (for api steps). Must start with http:// or https://"
                  },
                  "conditionKey": {
                    "type": "string",
                    "description": "Condition key for conditional steps",
                    "enum": [
                      "hasEmailAddress",
                      "hasLinkedinUrl",
                      "hasPhoneNumber",
                      "hasScore",
                      "emailsOpened",
                      "emailsClicked",
                      "emailsUnsubscribed",
                      "meetingBooked",
                      "linkedinInviteAccepted",
                      "linkedinOpened",
                      "aircallDone",
                      "linkedinNetworkCheck",
                      "hasWhatsappAccount"
                    ]
                  },
                  "delayType": {
                    "type": "string",
                    "description": "Delay type for conditional steps",
                    "enum": [
                      "within",
                      "waitUntil"
                    ]
                  },
                  "campaignId": {
                    "type": "string",
                    "description": "Target campaign ID for sendToAnotherCampaign steps. The campaign must exist and not be archived"
                  },
                  "images": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uri"
                    },
                    "description": "Public HTTPS URLs of images to attach to a `linkedinInvite` or `linkedinSend` step. Replaces the step's current images — pass an empty array to clear them. Allowed MIME types: `image/png`, `image/jpeg`, `image/gif`. Up to 20 MB per file, and up to 6 items total combined with `videos`."
                  },
                  "videos": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uri"
                    },
                    "description": "Public HTTPS URLs of videos to attach to a `linkedinInvite` or `linkedinSend` step. Replaces the step's current videos — pass an empty array to clear them. Allowed MIME types: `video/mp4`, `video/quicktime`. Up to 20 MB per file, and up to 6 items total combined with `images`."
                  },
                  "skillName": {
                    "type": "string",
                    "description": "Name of the LinkedIn skill to endorse on the lead's profile. Applies to `linkedinEndorse` steps only."
                  },
                  "endorseAnyFallback": {
                    "type": "boolean",
                    "description": "Applies to `linkedinEndorse` steps only. When `true` and the named skill is not on the lead's profile, lemlist falls back to endorsing any available skill."
                  },
                  "recordMode": {
                    "type": "string",
                    "description": "Applies to `linkedinVoiceNote` steps only. Determines how the audio is sourced. `manual` (default) means the user records the audio themselves from the lemlist UI after step creation; `ai` means lemlist generates the audio from a text template provided in the lemlist UI.",
                    "enum": [
                      "manual",
                      "ai"
                    ]
                  }
                }
              },
              "examples": {
                "Update Email Step": {
                  "value": {
                    "type": "email",
                    "subject": "{{firstName}}, following up on our conversation",
                    "message": "<p>Hi {{firstName}},</p><p>Just wanted to circle back on our previous email. Have you had a chance to review it?</p><p>Best,<br>{{senderName}}</p>",
                    "delay": 2
                  }
                },
                "Update LinkedIn Invite": {
                  "value": {
                    "type": "linkedinInvite",
                    "message": "Hi {{firstName}}, I'd love to connect with you to discuss potential collaboration opportunities!",
                    "delay": 0
                  }
                },
                "Update LinkedIn Send": {
                  "value": {
                    "type": "linkedinSend",
                    "message": "Thanks for accepting my invite, {{firstName}}! I wanted to reach out about...",
                    "altMessage": "Alternative message if the main one fails",
                    "delay": 3
                  }
                },
                "Update LinkedIn Send Media": {
                  "value": {
                    "type": "linkedinSend",
                    "images": [
                      "https://example.com/assets/overview.png"
                    ],
                    "videos": []
                  }
                },
                "Update Manual Task": {
                  "value": {
                    "type": "manual",
                    "title": "Schedule follow-up call",
                    "message": "Discuss pain points and propose next steps",
                    "delay": 2
                  }
                },
                "Update Phone Call": {
                  "value": {
                    "type": "phone",
                    "message": "Call to discuss the proposal sent via email",
                    "delay": 1
                  }
                },
                "Update API Call": {
                  "value": {
                    "type": "api",
                    "method": "PUT",
                    "url": "https://api.example.com/webhook/update",
                    "delay": 0
                  }
                },
                "Update LinkedIn Visit": {
                  "value": {
                    "type": "linkedinVisit",
                    "delay": 1
                  }
                },
                "Update Conditional Step": {
                  "value": {
                    "type": "conditional",
                    "conditionKey": "emailsOpened",
                    "delayType": "within",
                    "delay": 3
                  }
                },
                "Update Send to Another Campaign": {
                  "value": {
                    "type": "sendToAnotherCampaign",
                    "campaignId": "cam_XYZ789ABC123"
                  }
                },
                "Update WhatsApp Message": {
                  "value": {
                    "type": "whatsappMessage",
                    "message": "Hi {{firstName}}, just checking in to see if you received my previous messages.",
                    "delay": 2
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete Sequence Step",
        "tags": [
          "Sequences"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "headers": {
              "Content-Type": {
                "schema": {
                  "type": "string"
                },
                "example": "application/json"
              }
            },
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / You cannot delete this step because the campaign is running",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "404": {
            "description": "Possible errors: Sequence not found / Step not found",
            "content": {
              "text/plain": {
                "example": "Sequence not found"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/schedules": {
      "get": {
        "summary": "Get Many Schedules",
        "tags": [
          "Schedules"
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "The page number to retrieve",
            "example": "1",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "The number of records to skip. Used if page is not provided.",
            "example": "0",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "The maximum number of records to return",
            "example": "2",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "required": false,
            "description": "The field by which to sort the schedules. Currently, only 'createdAt' is supported.",
            "example": "createdAt",
            "schema": {
              "type": "string",
              "enum": [
                "createdAt"
              ]
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "required": false,
            "description": "The sort direction. Use 'desc' for descending order; any other value (or omission) will sort in ascending order.",
            "example": "desc",
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScheduleListResponse"
                },
                "example": {
                  "schedules": [
                    {
                      "_id": "skd_iQiNG7VinWIUkgLy1",
                      "name": "Custom Schedule",
                      "secondsToWait": 1200,
                      "timezone": "Europe/Paris",
                      "start": "09:00",
                      "end": "18:00",
                      "weekdays": [
                        1,
                        2,
                        3,
                        4
                      ],
                      "public": true,
                      "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                      "createdBy": "usr_ahfFktBBHUIxbVG5P",
                      "createdAt": "2025-10-27T09:41:11.187Z"
                    },
                    {
                      "_id": "skd_u6cfmo0a7pgwfup9i",
                      "name": "Default schedule",
                      "secondsToWait": 1200,
                      "timezone": "Europe/Paris",
                      "start": "09:00",
                      "end": "18:00",
                      "weekdays": [
                        1,
                        2,
                        3,
                        4,
                        5
                      ],
                      "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                      "createdBy": "usr_ahfFktBBHUIxbVG5P",
                      "createdAt": "2025-10-27T07:01:04.041Z"
                    },
                    {
                      "_id": "skd_nNGfP0HEkRYJLW4qA",
                      "name": "Default schedule",
                      "secondsToWait": 1200,
                      "timezone": "Asia/Seoul",
                      "start": "09:00",
                      "end": "18:00",
                      "weekdays": [
                        1,
                        2,
                        3,
                        4,
                        5
                      ],
                      "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                      "createdBy": "usr_ahfFktBBHUIxbVG5P",
                      "createdAt": "2025-10-24T09:37:25.040Z"
                    },
                    {
                      "_id": "skd_kgykTULiqy42doHxY",
                      "name": "Default schedule",
                      "secondsToWait": 1200,
                      "timezone": "Asia/Seoul",
                      "start": "09:00",
                      "end": "18:00",
                      "weekdays": [
                        1,
                        2,
                        3,
                        4,
                        5
                      ],
                      "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                      "createdBy": "usr_ahfFktBBHUIxbVG5P",
                      "createdAt": "2025-10-24T07:24:44.785Z"
                    },
                    {
                      "_id": "skd_SvcCMF1LTI3mgzmCW",
                      "name": "Default schedule",
                      "secondsToWait": 1200,
                      "timezone": "Europe/Sofia",
                      "start": "09:00",
                      "end": "18:00",
                      "weekdays": [
                        1,
                        2,
                        3,
                        4,
                        5
                      ],
                      "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                      "createdBy": "usr_46he8cjrZ7s0IQi53",
                      "createdAt": "2025-10-20T13:13:34.680Z"
                    }
                  ],
                  "pagination": {
                    "totalRecords": 3039,
                    "currentPage": 1,
                    "nextPage": 2,
                    "totalPage": 608
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create Schedule",
        "tags": [
          "Schedules"
        ],
        "security": [
          {
            "basicAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "The name of the schedule",
                    "default": "Default schedule"
                  },
                  "secondsToWait": {
                    "type": "integer",
                    "description": "Delay in seconds between operations",
                    "default": 1200
                  },
                  "timezone": {
                    "type": "string",
                    "description": "Timezone for the schedule (e.g., 'Europe/Paris')",
                    "default": "Europe/Paris"
                  },
                  "start": {
                    "type": "string",
                    "description": "Start time in HH:mm format",
                    "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
                    "default": "09:00"
                  },
                  "end": {
                    "type": "string",
                    "description": "End time in HH:mm format",
                    "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
                    "default": "18:00"
                  },
                  "weekdays": {
                    "type": "array",
                    "items": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 7
                    },
                    "description": "Days of the week the schedule is active (1=Monday, 7=Sunday)",
                    "default": [
                      1,
                      2,
                      3,
                      4,
                      5
                    ]
                  },
                  "public": {
                    "type": "boolean",
                    "description": "Set to true to make the schedule visible to use as a template",
                    "default": false
                  }
                },
                "required": [
                  "name",
                  "timezone",
                  "start",
                  "end",
                  "weekdays"
                ]
              },
              "example": {
                "name": "Default schedule",
                "secondsToWait": 1200,
                "timezone": "Europe/Paris",
                "start": "09:00",
                "end": "18:00",
                "weekdays": [
                  1,
                  2,
                  3,
                  4,
                  5
                ],
                "public": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Schedule successfully created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "$ref": "#/components/schemas/Schedule"
                },
                "example": {
                  "_id": "skd_VK2e2ON1xErgrc8NC",
                  "name": "Default schedule",
                  "secondsToWait": 120,
                  "timezone": "Europe/Paris",
                  "start": "09:00",
                  "end": "18:00",
                  "weekdays": [
                    1,
                    2,
                    3,
                    4,
                    5
                  ],
                  "public": false,
                  "teamId": "tea_oQGvp4rfqA5RWLkqW",
                  "createdBy": "usr_AUGImxyH3VKF6eYEf",
                  "createdAt": "2025-01-17T15:17:59.207Z"
                }
              }
            }
          },
          "400": {
            "description": "Bad request (invalid team or schedule data)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BadRequest",
                  "message": "Bad team or invalid schedule fields"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "The authentication you supplied is incorrect"
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/schedules/{scheduleId}": {
      "parameters": [
        {
          "name": "scheduleId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the schedule",
          "example": "skd_VK2e2ON1xErgrc8NC",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "summary": "Get Schedule",
        "tags": [
          "Schedules"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Schedule",
                  "required": [
                    "_id",
                    "name",
                    "secondsToWait",
                    "timezone",
                    "start",
                    "end",
                    "weekdays"
                  ]
                },
                "example": {
                  "_id": "skd_iQiNG7VinWIUkgLy1",
                  "name": "Renamed Schedule",
                  "secondsToWait": 1000,
                  "timezone": "Europe/Berlin",
                  "start": "08:00",
                  "end": "18:00",
                  "weekdays": [
                    1,
                    2,
                    3,
                    2,
                    5
                  ],
                  "public": true,
                  "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                  "createdBy": "usr_ahfFktBBHUIxbVG5P",
                  "createdAt": "2025-10-27T09:41:11.187Z"
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "404": {
            "description": "Schedule not found",
            "content": {
              "text/plain": {
                "example": "Schedule not found"
              }
            }
          }
        },
        "parameters": []
      },
      "patch": {
        "summary": "Update Schedule",
        "tags": [
          "Schedules"
        ],
        "security": [
          {
            "basicAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "The name of the schedule"
                  },
                  "secondsToWait": {
                    "type": "integer",
                    "description": "Delay in seconds between operations"
                  },
                  "timezone": {
                    "type": "string",
                    "description": "Timezone for the schedule (e.g., 'Europe/Paris')"
                  },
                  "start": {
                    "type": "string",
                    "description": "Start time in HH:mm format",
                    "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
                  },
                  "end": {
                    "type": "string",
                    "description": "End time in HH:mm format",
                    "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
                  },
                  "weekdays": {
                    "type": "array",
                    "items": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 7
                    },
                    "description": "Days of the week the schedule is active (1=Monday, 7=Sunday)"
                  },
                  "public": {
                    "type": "boolean",
                    "description": "Set to true to make the schedule visible to use as a template"
                  }
                }
              },
              "example": {
                "name": "Schedule new name"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Schedule successfully updated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "$ref": "#/components/schemas/Schedule"
                },
                "example": {
                  "_id": "skd_iQiNG7VinWIUkgLy1",
                  "name": "Renamed Schedule",
                  "secondsToWait": 1000,
                  "timezone": "Europe/Berlin",
                  "start": "08:00",
                  "end": "18:00",
                  "weekdays": [
                    1,
                    2,
                    3,
                    2,
                    5
                  ],
                  "public": true,
                  "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                  "createdBy": "usr_ahfFktBBHUIxbVG5P",
                  "createdAt": "2025-10-27T09:41:11.187Z"
                }
              }
            }
          },
          "400": {
            "description": "Bad request (invalid data or team)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "BadRequest",
                  "message": "Bad team or invalid schedule update"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "The authentication you supplied is incorrect"
                }
              }
            }
          },
          "404": {
            "description": "Schedule not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "Schedule not found"
                }
              }
            }
          }
        },
        "parameters": []
      },
      "delete": {
        "summary": "Delete Schedule",
        "tags": [
          "Schedules"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "_id": "skd_Z6mAiyX6c73uqQtCV"
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Schedule not found",
            "content": {
              "text/plain": {
                "example": "Schedule not found"
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/campaigns/{campaignId}/schedules/": {
      "parameters": [
        {
          "name": "campaignId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the campaign",
          "example": "cam_A1B2C3D4E5F6G7H8I9",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "summary": "Get Campaign Schedules",
        "tags": [
          "Schedules"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Schedule"
                  }
                },
                "example": [
                  {
                    "_id": "skd_dI6LDboHxORcW2quf",
                    "name": "Test 2",
                    "secondsToWait": 1200,
                    "timezone": "Atlantic/Reykjavik",
                    "start": "08:00",
                    "end": "18:00",
                    "weekdays": [
                      1,
                      2,
                      3,
                      4,
                      5
                    ],
                    "teamId": "tea_HpxHgbqZR5p7jPodG",
                    "createdBy": "usr_gbY1wCFnSHq5ubnyG",
                    "createdAt": "2025-02-06T16:29:10.217Z"
                  },
                  {
                    "_id": "skd_shtm9OHLWbGkro94C",
                    "name": "Default schedule",
                    "secondsToWait": 1200,
                    "timezone": "Africa/Ceuta",
                    "start": "09:00",
                    "end": "18:00",
                    "weekdays": [
                      1,
                      2,
                      3,
                      4,
                      5
                    ],
                    "teamId": "tea_HpxHgbqZR5p7jPodG",
                    "createdBy": "usr_z7biYanHn06hmOlXs",
                    "createdAt": "2025-02-06T15:36:01.531Z"
                  },
                  {
                    "_id": "skd_R90npZ8YWo0QqjO3u",
                    "name": "Default schedule",
                    "secondsToWait": 1200,
                    "timezone": "Europe/Paris",
                    "start": "09:00",
                    "end": "18:00",
                    "weekdays": [
                      1,
                      2,
                      3,
                      4,
                      5
                    ],
                    "teamId": "tea_HpxHgbqZR5p7jPodG",
                    "createdBy": "usr_z7biYanHn06hmOlXs",
                    "createdAt": "2025-02-06T15:35:52.079Z"
                  }
                ]
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Campaign not found",
            "content": {
              "text/plain": {
                "example": "Campaign not found"
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/campaigns/{campaignId}/schedules/{scheduleId}": {
      "parameters": [
        {
          "name": "campaignId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the campaign",
          "example": "cam_A1B2C3D4E5F6G7H8I9",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "scheduleId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the schedule",
          "example": "skd_J4m3pn7lRnVmwm02m",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "summary": "Associate Schedule with Campaign",
        "tags": [
          "Schedules"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "scheduleId": {
                      "type": "string"
                    },
                    "campaignId": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "scheduleId": "skd_J4m3pn7lRnVmwm02m",
                  "campaignId": "cam_JWW1H20HETqEXaKyR"
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Possible errors: Campaign not found / Schedule not found",
            "content": {
              "text/plain": {
                "example": "Campaign not found"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        },
        "parameters": []
      }
    },
    "/leads": {
      "get": {
        "summary": "Get Lead by Email or ID",
        "tags": [
          "Leads"
        ],
        "description": "Retrieve a lead using either their email address or lead ID",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": false,
            "description": "The lead ID. You should use at least one of 'email' or 'id'.",
            "example": "lea_8xJSc7sV7ggpiVnXe",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "email",
            "in": "query",
            "required": false,
            "description": "The lead email. You should use at least one of 'email' or 'id'.",
            "example": "john.doe@domain.com",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "query",
            "required": false,
            "description": "API version. v2 is the only option",
            "example": "v2",
            "schema": {
              "type": "string",
              "enum": [
                "v2"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "email": {
                      "type": "string",
                      "format": "email",
                      "description": "Email address of the lead"
                    },
                    "firstName": {
                      "type": "string",
                      "description": "First name of the lead"
                    },
                    "lastName": {
                      "type": "string",
                      "description": "Last name of the lead"
                    },
                    "companyName": {
                      "type": "string",
                      "description": "Company name"
                    },
                    "jobTitle": {
                      "type": "string",
                      "description": "Job title"
                    },
                    "companyDomain": {
                      "type": "string",
                      "description": "Company domain"
                    },
                    "_id": {
                      "type": "string",
                      "description": "Unique identifier for the lead"
                    },
                    "isPaused": {
                      "type": "boolean",
                      "description": "Indicates if the lead is paused"
                    },
                    "campaignId": {
                      "type": "string",
                      "description": "ID of the campaign the lead is associated with"
                    },
                    "contactId": {
                      "type": "string",
                      "description": "Associated contact ID (if any)"
                    },
                    "emailStatus": {
                      "type": "string",
                      "description": "Email status of the lead"
                    }
                  }
                },
                "example": {
                  "firstName": "John",
                  "lastName": "Doe",
                  "companyName": "lemlist",
                  "jobTitle": "GTM Engineer",
                  "companyDomain": "example.com",
                  "email": "support@lemlist.com",
                  "_id": "lea_fiDpiGV585wy3Oii2",
                  "isPaused": false,
                  "campaignId": "cam_bSn8EORHQxbWPjHvu",
                  "contactId": "ctc_xW8Ou6C03Csv8vatp",
                  "emailStatus": "deliverable"
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Lead not found",
            "content": {
              "text/plain": {
                "example": "Lead not found"
              }
            }
          }
        }
      }
    },
    "/leads/{email}": {
      "parameters": [
        {
          "name": "email",
          "in": "path",
          "required": true,
          "description": "The email address of the lead",
          "example": "john.doe@domain.com",
          "schema": {
            "type": "string",
            "format": "email"
          }
        }
      ],
      "get": {
        "summary": "Get Lead by Email",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "name": "version",
            "in": "query",
            "required": false,
            "description": "API version. v2 is the only option",
            "example": "v2",
            "schema": {
              "type": "string",
              "default": "v2",
              "enum": [
                "v2"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string",
                        "description": "Unique lead identifier"
                      },
                      "updatedAt": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Last update timestamp"
                      },
                      "isPaused": {
                        "type": "boolean",
                        "description": "Whether the lead is paused"
                      },
                      "state": {
                        "type": "string",
                        "description": "Current state of the lead (e.g., scanned, contacted)"
                      },
                      "status": {
                        "type": "string",
                        "description": "Current status (e.g., review, done)"
                      },
                      "personalized": {
                        "type": "boolean",
                        "description": "Whether the lead has personalized content"
                      },
                      "source": {
                        "type": "string",
                        "description": "Source of the lead (e.g., api, csv)"
                      },
                      "variables": {
                        "type": "object",
                        "description": "Custom variables associated with the lead",
                        "additionalProperties": true
                      },
                      "contactId": {
                        "type": "string",
                        "description": "Associated contact ID"
                      },
                      "enrichment": {
                        "type": "object",
                        "description": "Enrichment data",
                        "properties": {
                          "emailStatus": {
                            "type": "string",
                            "description": "Email verification status"
                          }
                        }
                      },
                      "campaign": {
                        "type": "object",
                        "description": "Campaign information",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Campaign ID"
                          },
                          "name": {
                            "type": "string",
                            "description": "Campaign name"
                          },
                          "status": {
                            "type": "string",
                            "description": "Campaign status"
                          }
                        }
                      },
                      "sendingUser": {
                        "type": "object",
                        "description": "Sending user information",
                        "additionalProperties": true
                      }
                    }
                  }
                },
                "example": [
                  {
                    "_id": "lea_fiDpiGV585wy3Oii2",
                    "updatedAt": "2025-10-28T00:40:39.230Z",
                    "isPaused": false,
                    "state": "scanned",
                    "status": "review",
                    "personalized": false,
                    "source": "api",
                    "variables": {
                      "firstName": "John",
                      "lastName": "Doe",
                      "companyName": "lemlist",
                      "jobTitle": "GTM Engineer",
                      "companyDomain": "example.com",
                      "email": "support@lemlist.com"
                    },
                    "contactId": "ctc_xW8Ou6C03Csv8vatp",
                    "enrichment": {
                      "emailStatus": "deliverable"
                    },
                    "campaign": {
                      "id": "cam_bSn8EORHQxbWPjHvu",
                      "name": "NEW TO DELETE",
                      "status": "draft"
                    },
                    "sendingUser": {}
                  }
                ]
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Lead not found",
            "content": {
              "text/plain": {
                "example": "Lead not found"
              }
            }
          }
        }
      }
    },
    "/campaigns/{campaignId}/leads/": {
      "parameters": [
        {
          "name": "campaignId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the campaign",
          "example": "cam_A1B2C3D4E5F6G7H8I9",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "summary": "Get Campaign Leads",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "Filter leads by state (e.g., scanned, contacted, interested, notInterested, etc.)",
            "example": "scanned",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of leads to return. Default: 100, Max: 500",
            "example": 100,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of leads in the campaign",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string",
                        "description": "Unique lead identifier"
                      },
                      "contactId": {
                        "type": "string",
                        "description": "Associated contact identifier"
                      },
                      "state": {
                        "type": "string",
                        "description": "Current lead state"
                      }
                    }
                  }
                },
                "example": [
                  {
                    "_id": "lea_A1B2C3D4E5F6G7H8I9",
                    "contactId": "con_Z9Y8X7W6V5U4T3S2R1",
                    "state": "scanned"
                  }
                ]
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create Lead in Campaign",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "name": "deduplicate",
            "in": "query",
            "required": false,
            "description": "Search email address in other campaigns. Will not insert the lead if email address already exists. Default: false",
            "example": "true",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "linkedinEnrichment",
            "in": "query",
            "required": false,
            "description": "Run the LinkedIn enrichment. Default: false",
            "example": "true",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "findEmail",
            "in": "query",
            "required": false,
            "description": "Find verified email. Default: false",
            "example": "true",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "verifyEmail",
            "in": "query",
            "required": false,
            "description": "Verify existing email (debounce). Default: false",
            "example": "true",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "findPhone",
            "in": "query",
            "required": false,
            "description": "Find phone number. Default: false",
            "example": "true",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "description": "Email of the lead"
                  },
                  "firstName": {
                    "type": "string",
                    "description": "First name of the lead"
                  },
                  "lastName": {
                    "type": "string",
                    "description": "Last name of the lead"
                  },
                  "companyName": {
                    "type": "string",
                    "description": "Company name"
                  },
                  "jobTitle": {
                    "type": "string",
                    "description": "Job title"
                  },
                  "linkedinUrl": {
                    "type": "string",
                    "description": "LinkedIn profile URL"
                  },
                  "picture": {
                    "type": "string",
                    "description": "Profile picture URL"
                  },
                  "phone": {
                    "type": "string",
                    "description": "Phone number"
                  },
                  "companyDomain": {
                    "type": "string",
                    "description": "Company domain"
                  },
                  "icebreaker": {
                    "type": "string",
                    "description": "Personalized icebreaker message"
                  },
                  "timezone": {
                    "type": "string",
                    "description": "Lead's timezone in IANA format (e.g., Europe/Paris, America/New_York)"
                  },
                  "contactOwner": {
                    "type": "string",
                    "description": "Contact owner (user ID or user login email)"
                  }
                }
              },
              "example": {
                "email": "support@lemlist.com",
                "firstName": "John",
                "lastName": "Doe",
                "companyName": "lemlist",
                "jobTitle": "Developer",
                "linkedinUrl": "https://www.linkedin.com/in/johndoe",
                "phone": "+33 123456789",
                "timezone": "Europe/Paris",
                "contactOwner": "login_email@lemlist.com"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaignId": {
                      "type": "string"
                    },
                    "campaignName": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string",
                      "format": "email"
                    },
                    "firstName": {
                      "type": "string"
                    },
                    "lastName": {
                      "type": "string"
                    },
                    "companyName": {
                      "type": "string"
                    },
                    "jobTitle": {
                      "type": "string"
                    },
                    "companyDomain": {
                      "type": "string"
                    },
                    "_id": {
                      "type": "string"
                    },
                    "isPaused": {
                      "type": "boolean",
                      "description": "Whether the lead is paused in the campaign"
                    },
                    "contactId": {
                      "type": "string",
                      "description": "Associated contact ID"
                    }
                  }
                },
                "example": {
                  "campaignId": "cam_bSn8EORHQxbWPjHvu",
                  "campaignName": "NEW TO DELETE",
                  "firstName": "John",
                  "lastName": "Doe",
                  "companyName": "lemlist",
                  "jobTitle": "GTM Engineer",
                  "companyDomain": "example.com",
                  "email": "support@lemlist.com",
                  "_id": "lea_fiDpiGV585wy3Oii2",
                  "isPaused": false,
                  "contactId": "ctc_xW8Ou6C03Csv8vatp"
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: No API key provided / Bad team",
            "content": {
              "text/plain": {
                "example": "No API key provided"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "403": {
            "description": "User linked to this API key is blocked",
            "content": {
              "text/plain": {
                "example": "User linked to this API key is blocked"
              }
            }
          },
          "404": {
            "description": "Possible errors: No user found for this API key / Campaign not found",
            "content": {
              "text/plain": {
                "example": "No user found for this API key"
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Unsubscribe Lead from Campaign",
        "tags": [
          "Leads"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "email": {
                      "type": "string"
                    },
                    "firstName": {
                      "type": "string"
                    },
                    "lastName": {
                      "type": "string"
                    },
                    "_id": {
                      "type": "string"
                    },
                    "isPaused": {
                      "type": "boolean"
                    },
                    "campaignId": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "email": "john.doe@domain.com",
                  "firstName": "John",
                  "lastName": "Doe",
                  "_id": "lea_8xJSc7sV7ggpiVnXe",
                  "isPaused": false,
                  "campaignId": "cam_A1B2C3D4E5F6G7H8I9"
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Lead not found",
            "content": {
              "text/plain": {
                "example": "Lead not found"
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/campaigns/{campaignId}/leads/{leadId}": {
      "parameters": [
        {
          "name": "campaignId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the campaign",
          "example": "cam_A1B2C3D4E5F6G7H8I9",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "leadId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the lead",
          "example": "lea_8xJSc7sV7ggpiVnXe",
          "schema": {
            "type": "string"
          }
        }
      ],
      "patch": {
        "summary": "Update Lead in a Campaign",
        "tags": [
          "Leads"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "firstName": {
                    "type": "string"
                  },
                  "lastName": {
                    "type": "string"
                  },
                  "companyName": {
                    "type": "string"
                  },
                  "jobTitle": {
                    "type": "string"
                  },
                  "preferredContactMethod": {
                    "type": "string",
                    "description": "Preferred contact method (email, linkedIn)"
                  }
                }
              },
              "example": {
                "preferredContactMethod": "email"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaignId": {
                      "type": "string"
                    },
                    "campaignName": {
                      "type": "string"
                    },
                    "leadUrl": {
                      "type": "string",
                      "description": "URL to access the lead"
                    },
                    "email": {
                      "type": "string",
                      "format": "email"
                    },
                    "firstName": {
                      "type": "string"
                    },
                    "lastName": {
                      "type": "string"
                    },
                    "companyName": {
                      "type": "string"
                    },
                    "jobTitle": {
                      "type": "string"
                    },
                    "companyDomain": {
                      "type": "string"
                    },
                    "preferredContactMethod": {
                      "type": "string"
                    },
                    "_id": {
                      "type": "string"
                    },
                    "isPaused": {
                      "type": "boolean",
                      "description": "Whether the lead is paused in the campaign"
                    },
                    "contactId": {
                      "type": "string",
                      "description": "Associated contact ID"
                    },
                    "emailStatus": {
                      "type": "string",
                      "description": "Email verification status"
                    }
                  }
                },
                "example": {
                  "campaignId": "cam_bSn8EORHQxbWPjHvu",
                  "campaignName": "NEW TO DELETE",
                  "leadUrl": "https://api.lemlist.com/api/leads/alex.doe%40example.com",
                  "firstName": "John",
                  "lastName": "Doe",
                  "companyName": "Acme Inc",
                  "jobTitle": "Growth Engineer",
                  "companyDomain": "example.com",
                  "email": "support@lemlist.com",
                  "preferredContactMethod": "email",
                  "_id": "lea_fiDpiGV585wy3Oii2",
                  "isPaused": false,
                  "contactId": "ctc_xW8Ou6C03Csv8vatp",
                  "emailStatus": "deliverable"
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Lead not found",
            "content": {
              "text/plain": {
                "example": "Lead not found"
              }
            }
          },
          "500": {
            "description": "Lead in graveyard"
          }
        },
        "parameters": []
      },
      "delete": {
        "summary": "Delete or Unsubscribe Lead",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "name": "action",
            "in": "query",
            "required": false,
            "description": "Use 'remove' to force delete. Otherwise it will just unsubscribe the lead from the campaign.",
            "example": "remove",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "firstName": {
                      "type": "string"
                    },
                    "lastName": {
                      "type": "string"
                    },
                    "companyName": {
                      "type": "string"
                    },
                    "jobTitle": {
                      "type": "string"
                    },
                    "companyDomain": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string",
                      "format": "email"
                    },
                    "preferredContactMethod": {
                      "type": "string"
                    },
                    "industry": {
                      "type": "string"
                    },
                    "Company name": {
                      "type": "string"
                    },
                    "_id": {
                      "type": "string"
                    },
                    "isPaused": {
                      "type": "boolean"
                    },
                    "campaignId": {
                      "type": "string"
                    },
                    "contactId": {
                      "type": "string"
                    },
                    "emailStatus": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": {
                    "type": "string"
                  }
                },
                "example": {
                  "firstName": "John",
                  "lastName": "Doe",
                  "companyName": "Acme Inc",
                  "jobTitle": "Growth Engineer",
                  "companyDomain": "example.com",
                  "email": "support@lemlist.com",
                  "preferredContactMethod": "email",
                  "industry": "Technology",
                  "Company name": "John Doe",
                  "_id": "lea_fiDpiGV585wy3Oii2",
                  "isPaused": false,
                  "campaignId": "cam_bSn8EORHQxbWPjHvu",
                  "contactId": "ctc_xW8Ou6C03Csv8vatp",
                  "emailStatus": "deliverable"
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Lead not found",
            "content": {
              "text/plain": {
                "example": "Lead not found"
              }
            }
          }
        }
      }
    },
    "/campaigns/{campaignId}/leads/{email}": {
      "parameters": [
        {
          "name": "campaignId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the campaign",
          "example": "cam_A1B2C3D4E5F6G7H8I9",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "email",
          "in": "path",
          "required": true,
          "description": "The email of the lead",
          "example": "alex.doe@example.com",
          "schema": {
            "type": "string"
          }
        }
      ],
      "delete": {
        "summary": "Unsubscribe Lead from Campaign",
        "tags": [
          "Leads"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "email": {
                      "type": "string",
                      "format": "email"
                    },
                    "_id": {
                      "type": "string"
                    },
                    "isPaused": {
                      "type": "boolean"
                    },
                    "campaignId": {
                      "type": "string"
                    },
                    "contactId": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "email": "alex.doe@example.com",
                  "_id": "lea_8RmJYElD9S5Jp2kyv",
                  "isPaused": false,
                  "campaignId": "cam_8qJ1qAE5tekBYkJac",
                  "contactId": "ctc_joap8q9YGlV45Ypc6"
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Lead not found",
            "content": {
              "text/plain": {
                "example": "Lead not found"
              }
            }
          }
        }
      }
    },
    "/leads/start/{leadId}": {
      "parameters": [
        {
          "name": "leadId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the lead",
          "example": "lea_8xJSc7sV7ggpiVnXe",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "summary": "Resume Paused Lead",
        "tags": [
          "Leads"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "firstName": {
                        "type": "string"
                      },
                      "lastName": {
                        "type": "string"
                      },
                      "companyName": {
                        "type": "string"
                      },
                      "jobTitle": {
                        "type": "string"
                      },
                      "companyDomain": {
                        "type": "string"
                      },
                      "email": {
                        "type": "string",
                        "format": "email"
                      },
                      "preferredContactMethod": {
                        "type": "string"
                      },
                      "industry": {
                        "type": "string"
                      },
                      "Company name": {
                        "type": "string"
                      },
                      "_id": {
                        "type": "string"
                      },
                      "isPaused": {
                        "type": "boolean"
                      },
                      "campaignId": {
                        "type": "string"
                      },
                      "contactId": {
                        "type": "string"
                      },
                      "emailStatus": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                },
                "example": [
                  {
                    "firstName": "John",
                    "lastName": "Doe",
                    "companyName": "Acme Inc",
                    "jobTitle": "Growth Engineer",
                    "companyDomain": "example.com",
                    "email": "support@lemlist.com",
                    "preferredContactMethod": "email",
                    "industry": "Technology",
                    "Company name": "John Doe",
                    "_id": "lea_fiDpiGV585wy3Oii2",
                    "isPaused": false,
                    "campaignId": "cam_bSn8EORHQxbWPjHvu",
                    "contactId": "ctc_xW8Ou6C03Csv8vatp",
                    "emailStatus": "deliverable"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Lead not found",
            "content": {
              "text/plain": {
                "example": "Lead not found"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        },
        "parameters": []
      }
    },
    "/leads/pause/{leadId}": {
      "parameters": [
        {
          "name": "leadId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the lead",
          "example": "lea_8xJSc7sV7ggpiVnXe",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "summary": "Pause Lead",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "name": "campaignId",
            "in": "query",
            "required": false,
            "description": "ID of the campaign. If provided, pauses the lead only in that campaign.",
            "example": "cam_A1B2C3D4E5F6G7H8I9",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "firstName": {
                        "type": "string"
                      },
                      "lastName": {
                        "type": "string"
                      },
                      "companyName": {
                        "type": "string"
                      },
                      "jobTitle": {
                        "type": "string"
                      },
                      "companyDomain": {
                        "type": "string"
                      },
                      "email": {
                        "type": "string",
                        "format": "email"
                      },
                      "preferredContactMethod": {
                        "type": "string"
                      },
                      "industry": {
                        "type": "string"
                      },
                      "Company name": {
                        "type": "string"
                      },
                      "_id": {
                        "type": "string"
                      },
                      "isPaused": {
                        "type": "boolean"
                      },
                      "campaignId": {
                        "type": "string"
                      },
                      "contactId": {
                        "type": "string"
                      },
                      "emailStatus": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                },
                "example": [
                  {
                    "firstName": "John",
                    "lastName": "Doe",
                    "companyName": "Acme Inc",
                    "jobTitle": "Growth Engineer",
                    "companyDomain": "example.com",
                    "email": "support@lemlist.com",
                    "preferredContactMethod": "email",
                    "industry": "Technology",
                    "Company name": "John Doe",
                    "_id": "lea_fiDpiGV585wy3Oii2",
                    "isPaused": true,
                    "campaignId": "cam_bSn8EORHQxbWPjHvu",
                    "contactId": "ctc_xW8Ou6C03Csv8vatp",
                    "emailStatus": "deliverable"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Lead not found",
            "content": {
              "text/plain": {
                "example": "Lead not found"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/leads/review/{leadId}": {
      "parameters": [
        {
          "name": "leadId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the lead to launch",
          "example": "lea_8xJSc7sV7ggpiVnXe",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "summary": "Launch Lead",
        "description": "Use this endpoint to launch a lead that is waiting for review, without having to enable campaign-wide auto-review.\n\nYou're auto launching this specific lead, while still enforcing every other launch guard: the campaign must have no step errors, any AI variables required by the campaign must be valid for the lead, and a sender must be available.\n\nNo need to enable autolaunch in the campaign.\n\nThis endpoint requires an `emailPro` plan or higher.",
        "tags": [
          "Leads"
        ],
        "responses": {
          "200": {
            "description": "Lead launched successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "description": "The lead cannot be launched. Possible `error` codes: `CAMPAIGN_LEAD_REVIEW_LEAD_PAUSED` (lead is paused), `CAMPAIGN_LEAD_REVIEW_LEAD_ALREADY_LAUNCHED` (lead is already launched), `CAMPAIGN_LEAD_REVIEW_LEAD_AI_VARIABLE_INVALID` (missing or invalid AI variables required by the campaign), `CAMPAIGN_LEAD_REVIEW_LEAD_NO_SENDER_AVAILABLE` (no sender available), `CAMPAIGN_LEAD_REVIEW_CAMPAIGN_STEP_ERRORS` (campaign has step errors).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "CAMPAIGN_LEAD_REVIEW_LEAD_ALREADY_LAUNCHED",
                  "message": "Lead is already launched"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Lead or campaign not found. Possible `error` codes: `CAMPAIGN_LEAD_REVIEW_LEAD_NOT_FOUND`, `CAMPAIGN_LEAD_REVIEW_CAMPAIGN_NOT_FOUND`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "CAMPAIGN_LEAD_REVIEW_LEAD_NOT_FOUND",
                  "message": "Lead not found"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/leads/interested/{leadIdOrEmail}": {
      "parameters": [
        {
          "name": "leadIdOrEmail",
          "in": "path",
          "required": true,
          "description": "The unique identifier or email of the lead",
          "example": "lea_8xJSc7sV7ggpiVnXe",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "summary": "Mark Lead as Interested",
        "tags": [
          "Leads"
        ],
        "description": "Mark a lead as interested across all campaigns",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "firstName": {
                        "type": "string"
                      },
                      "lastName": {
                        "type": "string"
                      },
                      "companyName": {
                        "type": "string"
                      },
                      "jobTitle": {
                        "type": "string"
                      },
                      "companyDomain": {
                        "type": "string"
                      },
                      "email": {
                        "type": "string",
                        "format": "email"
                      },
                      "preferredContactMethod": {
                        "type": "string"
                      },
                      "industry": {
                        "type": "string"
                      },
                      "Company name": {
                        "type": "string"
                      },
                      "_id": {
                        "type": "string"
                      },
                      "isPaused": {
                        "type": "boolean"
                      },
                      "campaignId": {
                        "type": "string"
                      },
                      "contactId": {
                        "type": "string"
                      },
                      "emailStatus": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                },
                "example": [
                  {
                    "firstName": "John",
                    "lastName": "Doe",
                    "companyName": "Acme Inc",
                    "jobTitle": "Growth Engineer",
                    "companyDomain": "example.com",
                    "email": "support@lemlist.com",
                    "preferredContactMethod": "email",
                    "industry": "Technology",
                    "Company name": "John Doe",
                    "_id": "lea_fiDpiGV585wy3Oii2",
                    "isPaused": false,
                    "campaignId": "cam_bSn8EORHQxbWPjHvu",
                    "contactId": "ctc_xW8Ou6C03Csv8vatp",
                    "emailStatus": "deliverable"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Lead not found",
            "content": {
              "text/plain": {
                "example": "Lead not found"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        },
        "parameters": []
      }
    },
    "/leads/notinterested/{leadIdOrEmail}": {
      "parameters": [
        {
          "name": "leadIdOrEmail",
          "in": "path",
          "required": true,
          "description": "The unique identifier or email of the lead",
          "example": "lea_8xJSc7sV7ggpiVnXe",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "summary": "Mark Lead as Not Interested",
        "tags": [
          "Leads"
        ],
        "description": "Mark a lead as not interested across all campaigns",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "firstName": {
                        "type": "string"
                      },
                      "lastName": {
                        "type": "string"
                      },
                      "companyName": {
                        "type": "string"
                      },
                      "jobTitle": {
                        "type": "string"
                      },
                      "companyDomain": {
                        "type": "string"
                      },
                      "email": {
                        "type": "string",
                        "format": "email"
                      },
                      "preferredContactMethod": {
                        "type": "string"
                      },
                      "industry": {
                        "type": "string"
                      },
                      "Company name": {
                        "type": "string"
                      },
                      "_id": {
                        "type": "string"
                      },
                      "isPaused": {
                        "type": "boolean"
                      },
                      "campaignId": {
                        "type": "string"
                      },
                      "contactId": {
                        "type": "string"
                      },
                      "emailStatus": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                },
                "example": [
                  {
                    "firstName": "John",
                    "lastName": "Doe",
                    "companyName": "Acme Inc",
                    "jobTitle": "Growth Engineer",
                    "companyDomain": "example.com",
                    "email": "support@lemlist.com",
                    "preferredContactMethod": "email",
                    "industry": "Technology",
                    "Company name": "John Doe",
                    "_id": "lea_fiDpiGV585wy3Oii2",
                    "isPaused": false,
                    "campaignId": "cam_bSn8EORHQxbWPjHvu",
                    "contactId": "ctc_xW8Ou6C03Csv8vatp",
                    "emailStatus": "deliverable"
                  }
                ]
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Lead not found",
            "content": {
              "text/plain": {
                "example": "Lead not found"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        },
        "parameters": []
      }
    },
    "/campaigns/{campaignId}/leads/{leadIdOrEmail}/interested": {
      "parameters": [
        {
          "name": "campaignId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the campaign",
          "example": "cam_A1B2C3D4E5F6G7H8I9",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "leadIdOrEmail",
          "in": "path",
          "required": true,
          "description": "The unique identifier or email of the lead",
          "example": "lea_8xJSc7sV7ggpiVnXe",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "summary": "Mark Lead as Interested in Campaign",
        "tags": [
          "Leads"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "firstName": {
                      "type": "string"
                    },
                    "lastName": {
                      "type": "string"
                    },
                    "companyName": {
                      "type": "string"
                    },
                    "jobTitle": {
                      "type": "string"
                    },
                    "companyDomain": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string",
                      "format": "email"
                    },
                    "preferredContactMethod": {
                      "type": "string"
                    },
                    "industry": {
                      "type": "string"
                    },
                    "Company name": {
                      "type": "string"
                    },
                    "_id": {
                      "type": "string"
                    },
                    "isPaused": {
                      "type": "boolean"
                    },
                    "campaignId": {
                      "type": "string"
                    },
                    "contactId": {
                      "type": "string"
                    },
                    "emailStatus": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": {
                    "type": "string"
                  }
                },
                "example": {
                  "firstName": "John",
                  "lastName": "Doe",
                  "companyName": "Acme Inc",
                  "jobTitle": "Growth Engineer",
                  "companyDomain": "example.com",
                  "email": "support@lemlist.com",
                  "preferredContactMethod": "email",
                  "industry": "Technology",
                  "Company name": "John Doe",
                  "_id": "lea_fiDpiGV585wy3Oii2",
                  "isPaused": false,
                  "campaignId": "cam_bSn8EORHQxbWPjHvu",
                  "contactId": "ctc_xW8Ou6C03Csv8vatp",
                  "emailStatus": "deliverable"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Possible errors: Campaign not found / Lead not found",
            "content": {
              "text/plain": {
                "example": "Campaign not found"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        },
        "parameters": []
      }
    },
    "/campaigns/{campaignId}/leads/{leadIdOrEmail}/notinterested": {
      "parameters": [
        {
          "name": "campaignId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the campaign",
          "example": "cam_A1B2C3D4E5F6G7H8I9",
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "leadIdOrEmail",
          "in": "path",
          "required": true,
          "description": "The unique identifier or email of the lead",
          "example": "lea_8xJSc7sV7ggpiVnXe",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "summary": "Mark Lead as Not Interested in Campaign",
        "tags": [
          "Leads"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "firstName": {
                      "type": "string"
                    },
                    "lastName": {
                      "type": "string"
                    },
                    "companyName": {
                      "type": "string"
                    },
                    "jobTitle": {
                      "type": "string"
                    },
                    "companyDomain": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string",
                      "format": "email"
                    },
                    "preferredContactMethod": {
                      "type": "string"
                    },
                    "industry": {
                      "type": "string"
                    },
                    "Company name": {
                      "type": "string"
                    },
                    "_id": {
                      "type": "string"
                    },
                    "isPaused": {
                      "type": "boolean"
                    },
                    "campaignId": {
                      "type": "string"
                    },
                    "contactId": {
                      "type": "string"
                    },
                    "emailStatus": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": {
                    "type": "string"
                  }
                },
                "example": {
                  "firstName": "John",
                  "lastName": "Doe",
                  "companyName": "Acme Inc",
                  "jobTitle": "Growth Engineer",
                  "companyDomain": "example.com",
                  "email": "support@lemlist.com",
                  "preferredContactMethod": "email",
                  "industry": "Technology",
                  "Company name": "John Doe",
                  "_id": "lea_fiDpiGV585wy3Oii2",
                  "isPaused": false,
                  "campaignId": "cam_bSn8EORHQxbWPjHvu",
                  "contactId": "ctc_xW8Ou6C03Csv8vatp",
                  "emailStatus": "deliverable"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Possible errors: Campaign not found / Lead not found",
            "content": {
              "text/plain": {
                "example": "Campaign not found"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        },
        "parameters": []
      }
    },
    "/leads/{leadId}/variables": {
      "parameters": [
        {
          "name": "leadId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the lead",
          "example": "lea_8xJSc7sV7ggpiVnXe",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "summary": "Add Custom Variables on Leads",
        "tags": [
          "Leads"
        ],
        "description": "Add custom variables to a lead and sets values for that specific lead.",
        "parameters": [
          {
            "name": "customField1",
            "in": "query",
            "required": false,
            "description": "Example custom variable",
            "example": "Lemlist",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customField2",
            "in": "query",
            "required": false,
            "description": "Example custom variable",
            "example": "Will Rule",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customField3",
            "in": "query",
            "required": false,
            "description": "Example custom variable",
            "example": "The World",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Variable not found"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Lead not found",
            "content": {
              "text/plain": {
                "example": "Lead not found"
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Update Values of Custom Variables of a Lead",
        "tags": [
          "Leads"
        ],
        "description": "Update values of custom variables for a lead.",
        "parameters": [
          {
            "name": "customField1",
            "in": "query",
            "required": false,
            "description": "Example custom variable",
            "example": "Lemlist",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customField2",
            "in": "query",
            "required": false,
            "description": "Example custom variable",
            "example": "Will Rule",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customField3",
            "in": "query",
            "required": false,
            "description": "Example custom variable",
            "example": "The World",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Lead not found",
            "content": {
              "text/plain": {
                "example": "Lead not found"
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Erase Values of Custom Variables on a Lead",
        "tags": [
          "Leads"
        ],
        "description": "Erases the values of custom variables on a lead.",
        "parameters": [
          {
            "name": "customField1",
            "in": "query",
            "required": false,
            "description": "Example custom variable",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customField2",
            "in": "query",
            "required": false,
            "description": "Example custom variable",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customField3",
            "in": "query",
            "required": false,
            "description": "Example custom variable",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Lead not found",
            "content": {
              "text/plain": {
                "example": "Lead not found"
              }
            }
          }
        }
      }
    },
    "/leads/audio": {
      "post": {
        "summary": "Upload Audio for Voice Message Step",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "name": "leadId",
            "in": "query",
            "required": true,
            "description": "The unique identifier of the lead",
            "example": "lea_8xJSc7sV7ggpiVnXe",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "stepId",
            "in": "query",
            "required": true,
            "description": "The unique identifier of the voice message step",
            "example": "stp_xflJG8ZxUjc9vb2ce",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "Audio file to upload"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string"
                        },
                        "teamId": {
                          "type": "string"
                        },
                        "campaignId": {
                          "type": "string"
                        },
                        "leadId": {
                          "type": "string"
                        },
                        "fileName": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "status": {
                    "url": "https://example.com/files/fil_CD7M60ym74aR0e57f.m4a",
                    "teamId": "tea_Sh11ph1qHfjSpLKGT",
                    "campaignId": "cam_R9mwDo0iZRwNEHUcW",
                    "leadId": "lea_jZKIJ1Jn1SaMsP83s",
                    "fileName": "file2"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / Invalid audio file",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/crm/filters": {
      "get": {
        "summary": "Get CRM Filters",
        "tags": [
          "Leads"
        ],
        "parameters": [
          {
            "name": "crm",
            "in": "query",
            "required": true,
            "description": "CRM name (e.g., hubspot, salesforce, pipedrive)",
            "example": "hubspot",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "in": "query",
            "required": true,
            "description": "Connected user ID",
            "example": "usr_FU6yAd3UdBFel0UDy",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "Filter type for Salesforce. Can be: lead, contact, or report.",
            "example": "lead",
            "schema": {
              "type": "string",
              "enum": [
                "lead",
                "contact",
                "report"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CrmFilter"
                  }
                },
                "example": [
                  {
                    "id": 16,
                    "name": "Filter 1"
                  },
                  {
                    "id": 17,
                    "name": "Filter 2"
                  }
                ]
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/campaigns/{campaignId}/leads/import": {
      "parameters": [
        {
          "name": "campaignId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the campaign",
          "example": "cam_A1B2C3D4E5F6G7H8I9",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "summary": "Import Leads from CRM",
        "tags": [
          "Leads"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "crm": {
                    "type": "string",
                    "description": "CRM name"
                  },
                  "userId": {
                    "type": "string",
                    "description": "User ID with CRM connection"
                  },
                  "filterId": {
                    "type": "string",
                    "description": "Filter ID from the CRM"
                  },
                  "filterType": {
                    "type": "string",
                    "description": "Type of filter (for Salesforce)"
                  },
                  "deduplicate": {
                    "type": "boolean",
                    "description": "Whether to deduplicate leads"
                  }
                },
                "required": [
                  "crm",
                  "userId",
                  "filterId"
                ]
              },
              "example": {
                "crm": "hubspot",
                "userId": "usr_FU6yAd3UdBFel0UDy",
                "filterId": "16",
                "deduplicate": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        },
        "parameters": []
      }
    },
    "/database/filters": {
      "get": {
        "summary": "Get Database Filters",
        "tags": [
          "People Database"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DatabaseFilter"
                  }
                },
                "example": [
                  {
                    "filterId": "country",
                    "description": "Filter by country",
                    "mode": [
                      "leads",
                      "companies"
                    ],
                    "type": "text",
                    "helper": "Use free text search"
                  }
                ]
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        },
        "parameters": []
      }
    },
    "/database/people": {
      "post": {
        "summary": "Search People Database",
        "description": "This endpoint allows you to query our People database. To do so, you may use the following parameters: filters (required), page (optional), size (optional), and excludes (optional). Each filter should have the following properties: filterId (filter identifier), in (list of the values you want to include), and out (list of the values you want to exclude). To know which filters you are able to use, refer to the GET Filters section.",
        "operationId": "searchPeopleDatabase",
        "tags": [
          "People Database"
        ],
        "requestBody": {
          "description": "Search criteria. Provide one or more filters and optionally control pagination with page/size",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "filters": {
                    "type": "array",
                    "description": "Array of filters (required)",
                    "items": {
                      "type": "object",
                      "properties": {
                        "filterId": {
                          "type": "string",
                          "description": "Filter identifier"
                        },
                        "in": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "List of the values you want to include"
                        },
                        "out": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "List of the values you want to exclude"
                        }
                      }
                    }
                  },
                  "page": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Page (optional)"
                  },
                  "size": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "description": "Size of the results, number between 1 and 100 (optional)"
                  },
                  "excludes": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Array of properties to exclude from the results (optional)"
                  },
                  "search": {
                    "type": "string",
                    "description": "Free-text query across common people fields (e.g., name, title, company, location)"
                  }
                }
              },
              "example": {
                "filters": [
                  {
                    "filterId": "country",
                    "in": [
                      "France"
                    ],
                    "out": [
                      "India"
                    ]
                  }
                ],
                "page": 1,
                "size": 25
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "description": "Results array",
                      "items": {
                        "$ref": "#/components/schemas/PeopleSchema"
                      }
                    },
                    "total": {
                      "type": "integer",
                      "description": "Total number of results"
                    },
                    "took": {
                      "type": "integer",
                      "description": "Duration of the elastic-search query in milliseconds"
                    },
                    "page": {
                      "type": "integer",
                      "description": "Current page number"
                    },
                    "size": {
                      "type": "integer",
                      "description": "Size of the results (asked through parameters)"
                    },
                    "search": {
                      "type": "string",
                      "description": "Unique identifier of the current search"
                    },
                    "limitation": {
                      "type": "integer",
                      "description": "Remaining calls for the POST People database and POST Companies database (search is limited to a number of queries every 24 hours)"
                    },
                    "team": {
                      "type": "string",
                      "description": "Unique identifier of the current team"
                    }
                  }
                },
                "example": {
                  "results": [
                    {
                      "lead_id": 434482354,
                      "canonical_shorthand_name": "alexdoe",
                      "connections_count": 500,
                      "country": "France",
                      "full_name": "Alex Doe",
                      "education": [],
                      "experience_count": 3,
                      "experiences": [
                        {
                          "company_shorthand_name": "lemlist",
                          "company_id": 11750398,
                          "company_name": "lemlist",
                          "company_website_url": "https://www.lemlist.com",
                          "company_linkedin_url": "https://www.linkedin.com/company/lemlist",
                          "company_employee_count": 151,
                          "company_size": "51-200",
                          "company_domain": "lemlist.com",
                          "company_industry": "Technology, Information and Media",
                          "title": "Account Executive",
                          "title_normalized": "Account Executive",
                          "date_from": "September 2025",
                          "duration": "1 month",
                          "location": "Ville de Paris, Île-de-France, France",
                          "current_exp_bucket": "Less than 6 months"
                        }
                      ],
                      "interests": [],
                      "languages": [
                        {
                          "language": "Français",
                          "proficiency": "Native or bilingual proficiency"
                        },
                        {
                          "language": "Anglais",
                          "proficiency": "Professional working proficiency"
                        }
                      ],
                      "lead_linkedin_url": "https://www.linkedin.com/in/alex-doe",
                      "linkedin_short": "alex-doe",
                      "skills": [],
                      "summary": "Passionate about helping sales teams book more meetings @lemlist",
                      "headline": "Helping RevOps scale outbound @lemlist",
                      "lead_quality_score": 3,
                      "department": "Sales",
                      "connections_count_bucket": "500+",
                      "years_of_exp_bucket": "2 to 5 years",
                      "location": "Paris, Ile-de-France, France",
                      "state": "Ile-de-France",
                      "current_exp_company_name": "lemlist",
                      "_score": 21.294434,
                      "_id": "434482354"
                    }
                  ],
                  "total": 91,
                  "took": 24,
                  "page": 1,
                  "size": 1,
                  "search": "lsh_Lra0u9F7WXn3XKzB9",
                  "limitation": 1999,
                  "team": "tea_8QvkOiBfPdb2ZRhHi"
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / Parameter filters is invalid",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        },
        "parameters": []
      }
    },
    "/database/companies": {
      "post": {
        "summary": "Search Companies Database",
        "description": "Search the lemlist Companies database using structured filters with pagination support. Returns comprehensive company data including technologies used, location, employee count, and other business intelligence.",
        "tags": [
          "People Database"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "filters": {
                    "type": "array",
                    "description": "Array of filter objects to narrow down search results. Each filter has a filterId and inclusion/exclusion criteria.",
                    "items": {
                      "type": "object",
                      "properties": {
                        "filterId": {
                          "type": "string",
                          "description": "The identifier of the filter to apply (e.g., 'currentCompanyTechnologies', 'companySize', 'industry')"
                        },
                        "in": {
                          "type": "array",
                          "description": "Array of values to include in the filter",
                          "items": {
                            "type": "string"
                          }
                        },
                        "out": {
                          "type": "array",
                          "description": "Array of values to exclude from the filter",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  },
                  "page": {
                    "type": "integer",
                    "description": "Page number for pagination (default: 1)"
                  },
                  "size": {
                    "type": "integer",
                    "description": "Number of results per page (default: 100, max: 500)"
                  }
                }
              },
              "example": {
                "filters": [
                  {
                    "filterId": "currentCompanyTechnologies",
                    "in": [
                      "Postman"
                    ],
                    "out": [
                      "Haskell"
                    ]
                  }
                ],
                "page": 1,
                "size": 2
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "$ref": "#/components/schemas/CompaniesSchema"
                      }
                    },
                    "total": {
                      "type": "integer",
                      "description": "Total number of companies matching the search criteria"
                    },
                    "took": {
                      "type": "integer",
                      "description": "Time taken for the search in milliseconds"
                    },
                    "page": {
                      "type": "integer",
                      "description": "Current page number"
                    },
                    "size": {
                      "type": "integer",
                      "description": "Number of results per page"
                    },
                    "search": {
                      "type": "string",
                      "description": "Search session identifier"
                    },
                    "limitation": {
                      "type": "integer",
                      "description": "Result limitation applied"
                    },
                    "team": {
                      "type": "string",
                      "description": "Team identifier"
                    }
                  }
                },
                "example": {
                  "results": [
                    {
                      "company_id": "88945664",
                      "company_website_url": "http://acme-tech.example.com",
                      "company_name": "Acme Technologies",
                      "company_linkedin_url": "https://www.linkedin.com/company/acme-technologies",
                      "last_updated": "2025-09-07 02:11:32 UTC",
                      "company_headquarters_city": "Example City",
                      "company_headquarters_country": "India",
                      "company_logo_url": "https://example.com/logo1.png",
                      "company_description": "Acme, established on Aug-2015 with the idea \"Make Your Imagination Come True\". Which means anyone who came up with their idea, we will give a closely realistic solutions to them. \nAcme Technologies is a new Generation Software Company, with young people with creative mind and immersive energy. We are a team of dedicated and highly skilled software professionals focused on providing world class IT solutions. We offer a variety of services in the area of:\nWebsite Designing & Development, Web Maintenance, E-Business Solutions, Android & iOS app, Blockchain Development, Software Development, Hosting Services.",
                      "company_employee_count": "31",
                      "company_type": "Public Company",
                      "company_founded": "2015",
                      "company_followers_count": "3958",
                      "company_size": "11-50",
                      "company_domain": "acme-tech.example.com",
                      "employees_count_growth": -3,
                      "techno_used_array": [
                        "Apache HTTP Server",
                        "Lightbox",
                        "LinkedIn Sales Navigator",
                        "Atlassian Jira",
                        "LiteSpeed Cache",
                        "Underscore.js",
                        "Remix",
                        "jsDelivr",
                        "jQuery",
                        "Google Fonts API",
                        "Google Tag Manager",
                        "X-Content-Type-Options",
                        "Facebook",
                        "PWA",
                        "jQuery CDN",
                        "ZURB Foundation",
                        "HSTS",
                        "WhatsApp Business",
                        "X-XSS-Protection",
                        "Google Analytics",
                        "Flickity",
                        "HTML",
                        "LiteSpeed",
                        "Ethereum",
                        "Cloudinary",
                        "OceanWP",
                        "Goober",
                        "jQuery Migrate",
                        "Tailwind CSS",
                        "Postman",
                        "LinkedIn",
                        "Webpack",
                        "GSAP",
                        "Essential Addons for Elementor",
                        "Font Awesome",
                        "Android",
                        "PixelYourSite",
                        "jQuery UI",
                        "MUI",
                        "IPFS",
                        "Upwork",
                        "cdnjs",
                        "FlexSlider",
                        "Elementor",
                        "ZoomInfo",
                        "Swiper",
                        "Microsoft IIS",
                        "Node.js",
                        "Ethers",
                        "Solidity",
                        "React",
                        "Priority Hints",
                        "iOS",
                        "OWL Carousel",
                        "MySQL",
                        "Facebook Pixel",
                        "Open Graph",
                        "Laravel",
                        "Emotion",
                        "Lucide",
                        "PHP",
                        "Blockchain",
                        "Next.js",
                        "RSS",
                        "Google Maps",
                        "Windows Server",
                        "WordPress",
                        "WPForms",
                        "JavaScript",
                        "Chainlink",
                        "Apache",
                        "Bootstrap"
                      ],
                      "business_business_customer": "B2B",
                      "company_quality_score": "3",
                      "company_industry": "Technology, Information and Media",
                      "company_subindustry": "Technology, Information and Internet",
                      "company_subsubindustry": "Software Development",
                      "company_location": "123 Example Street, Suite 100, Example City, Example Country",
                      "company_location_geopoint_array": [
                        73.92,
                        18.64
                      ],
                      "company_occ_lead": "60",
                      "_score": 10.002095,
                      "_id": "88945664"
                    },
                    {
                      "company_id": "9903838",
                      "company_website_url": "http://www.acme-care.example.com",
                      "company_name": "Acme Care",
                      "company_linkedin_url": "https://www.linkedin.com/company/acme-care",
                      "last_updated": "2025-09-04 14:24:45 UTC",
                      "company_headquarters_city": "San Francisco, California",
                      "company_headquarters_country": "United States",
                      "company_logo_url": "https://example.com/logo2.png",
                      "company_description": "Acme Care provides an automated platform for team-based care management. To learn more, write us at contact@acme-care.example.com.",
                      "company_employee_count": "33",
                      "company_type": "Privately Held",
                      "company_founded": "2013",
                      "company_followers_count": "2651",
                      "company_size": "11-50",
                      "revenue_bucket": "$5M - $10M",
                      "company_domain": "acme-care.example.com",
                      "employees_count_growth": 6,
                      "last_funding_round_at": "More than 6 months",
                      "techno_used_array": [
                        "Google Cloud",
                        "Heap",
                        "Envoy",
                        "Google Cloud CDN",
                        "X-Content-Type-Options",
                        "Piwik",
                        "WP Engine",
                        "React",
                        "cdnjs",
                        "Fullstory",
                        "Cloudflare Bot Management",
                        "Twitter",
                        "JSON-LD",
                        "C3.js",
                        "Python",
                        "Google Analytics",
                        "MediaElement.js",
                        "SafeBase",
                        "Emotion",
                        "Nginx",
                        "Atlassian Jira",
                        "PayPal",
                        "MUI",
                        "Gravity Forms",
                        "Zendesk",
                        "MySQL",
                        "Webpack",
                        "PHP",
                        "Facebook Pixel",
                        "Google Fonts API",
                        "OneTrust",
                        "jQuery",
                        "Gravatar",
                        "Google Hosted Libraries",
                        "Yoast SEO",
                        "Jamf",
                        "Cloudflare CDN",
                        "Angular",
                        "Postman",
                        "Cloudflare",
                        "HubSpot",
                        "Java",
                        "HTTP/3",
                        "Moment.js",
                        "X-XSS-Protection",
                        "Open Graph",
                        "JazzHR",
                        "Workramp",
                        "Algolia",
                        "SSL.com",
                        "Autoptimize",
                        "Font Awesome",
                        "oEmbed",
                        "Bootstrap",
                        "Facebook",
                        "HSTS",
                        "Ruby",
                        "Twemoji",
                        "WordPress",
                        "Lightbox",
                        "Adobe Fonts",
                        "RequireJS",
                        "Ruby on Rails",
                        "Lodash",
                        "reCAPTCHA",
                        "LinkedIn Ads",
                        "Hotjar",
                        "Google Tag Manager"
                      ],
                      "business_business_customer": "B2B",
                      "company_quality_score": "3",
                      "company_industry": "Technology, Information and Media",
                      "company_subindustry": "Technology, Information and Internet",
                      "company_subsubindustry": "Software Development",
                      "company_location": "San Francisco, California, US",
                      "company_location_geopoint_array": [
                        -122.42,
                        37.78
                      ],
                      "company_occ_lead": "117",
                      "_score": 9.972561,
                      "_id": "9903838"
                    }
                  ],
                  "total": 12102,
                  "took": 17,
                  "page": 1,
                  "size": 2,
                  "search": "lsh_8LBpZPgGpxGswp5G7",
                  "limitation": 1998,
                  "team": "tea_8QvkOiBfPdb2ZRhHi"
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / Parameter filters is invalid",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        },
        "parameters": []
      }
    },
    "/tasks": {
      "get": {
        "summary": "Get Many Tasks",
        "description": "Retrieve tasks with optional filtering and pagination. Tasks marked as `done` are excluded from results.",
        "tags": [
          "Tasks"
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "Page number for paginated results (0-indexed).",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 0
            }
          },
          {
            "name": "filters",
            "in": "query",
            "description": "JSON array of filter objects. Each filter has a `filterId` and specific parameters.\n\n**Available Filters:**\n\n- `fullName`: Filter by contact's full name.\n  - Parameters: `value` (string) or `regex` (string)\n  - Example: `{\"filterId\":\"fullName\",\"value\":\"John Doe\"}`\n\n- `email`: Filter by contact's email address.\n  - Parameters: `value` (string) or `regex` (string)\n  - Example: `{\"filterId\":\"email\",\"value\":\"john@example.com\"}`\n\n- `phone`: Filter by contact's phone number.\n  - Parameters: `value` (string) or `regex` (string)\n  - Example: `{\"filterId\":\"phone\",\"value\":\"+1234567890\"}`\n\n- `linkedin`: Filter by LinkedIn profile URL.\n  - Parameters: `value` (string) or `regex` (string)\n  - Example: `{\"filterId\":\"linkedin\",\"value\":\"linkedin.com/in/johndoe\"}`\n\n- `campaignId`: Filter by campaign IDs (inclusion/exclusion).\n  - Parameters: `in` (array of strings) and/or `out` (array of strings)\n  - Example: `{\"filterId\":\"campaignId\",\"in\":[\"cam_123\"],\"out\":[\"cam_456\"]}`\n\n- `campaignState`: Filter by campaign states.\n  - Parameters: `in` (array of strings) and/or `out` (array of strings)\n  - Allowed values: `draft`, `running`, `ended`, `paused`, `errors`, `archived`\n  - Example: `{\"filterId\":\"campaignState\",\"in\":[\"running\",\"paused\"]}`\n\n- `type`: Filter by task type.\n  - Parameters: `in` (array of strings) and/or `out` (array of strings)\n  - Allowed values: `manual`, `phone`, `linkedinInvite`, `linkedinSend`, `linkedinVoiceNote`, `emailsReplied`, `opportunityReplied`, `linkedinReplied`, `opportunityClicked`, `email`, `whatsappMessage`\n  - Example: `{\"filterId\":\"type\",\"in\":[\"phone\",\"email\"]}`\n\n- `assignedTo`: Filter by assigned user IDs.\n  - Parameters: `in` (array of strings) and/or `out` (array of strings)\n  - Example: `{\"filterId\":\"assignedTo\",\"in\":[\"usr_123\",\"usr_456\"]}`\n\n- `dueDate`: Filter by due date range.\n  - Parameters: `from` (string, YYYY-MM-DD) and/or `to` (string, YYYY-MM-DD)\n  - Example: `{\"filterId\":\"dueDate\",\"from\":\"2025-01-01\",\"to\":\"2025-12-31\"}`\n\nMultiple filters can be combined in an array.",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "[{\"filterId\":\"dueDate\",\"from\":\"2025-02-11\",\"to\":\"2025-02-28\"},{\"filterId\":\"type\",\"in\":[\"phone\",\"linkedinSend\"]}]"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Task"
                      }
                    },
                    "page": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "results": [
                    {
                      "_id": "opp_LyXDV8KHzctQdLFpG",
                      "type": "manual",
                      "title": "Keep an eye on him",
                      "priority": 1,
                      "leadId": "lea_fiDpiGV585wy3Oii2",
                      "campaignId": "cam_bSn8EORHQxbWPjHvu",
                      "contactId": "ctc_xW8Ou6C03Csv8vatp",
                      "dueDate": "2025-11-10T09:58:57.169Z",
                      "userId": "usr_ahfFktBBHUIxbVG5P",
                      "content": "does he have bandwidth to help us? would be grand"
                    },
                    {
                      "_id": "opp_KNQOrrlGnLvEXDDS9",
                      "type": "manual",
                      "title": "API Reference Illustration",
                      "priority": 2,
                      "dueDate": "2025-10-31T07:58:00.000Z",
                      "userId": "usr_ahfFktBBHUIxbVG5P",
                      "content": ""
                    }
                  ],
                  "page": "0"
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create Task",
        "description": "Create a manual task (opportunity) associated with a contact/company or lead.",
        "tags": [
          "Tasks"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "recordId": {
                    "type": "string",
                    "description": "The ID of the contact company or lead associated with the task."
                  },
                  "type": {
                    "type": "string",
                    "description": "The type of task.",
                    "enum": [
                      "email",
                      "manual",
                      "phone",
                      "linkedin"
                    ]
                  },
                  "assignedTo": {
                    "type": "string",
                    "description": "The ID of the team member assigned to the task (userId)."
                  },
                  "dueDate": {
                    "type": "string",
                    "format": "date-time",
                    "description": "The due date in ISO 8601 format (e.g., 2025-02-12T00:00:00.000Z)."
                  },
                  "title": {
                    "type": "string",
                    "description": "Optional title of the task. Defaults to an empty string if omitted.",
                    "default": ""
                  },
                  "message": {
                    "type": "string",
                    "description": "Optional message/description of the task. Defaults to an empty string if omitted.",
                    "default": ""
                  },
                  "priority": {
                    "type": "string",
                    "description": "Priority level of the task.",
                    "enum": [
                      "",
                      "0",
                      "1",
                      "2"
                    ],
                    "default": ""
                  },
                  "images": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uri"
                    },
                    "description": "Public HTTPS URLs of images to attach to a `linkedin` task. lemlist downloads each file and re-hosts it. Ignored when `type` is not `linkedin`. Allowed MIME types: `image/png`, `image/jpeg`, `image/gif`. Up to 20 MB per file, and up to 6 items total combined with `videos`."
                  },
                  "videos": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uri"
                    },
                    "description": "Public HTTPS URLs of videos to attach to a `linkedin` task. lemlist downloads each file and re-hosts it. Ignored when `type` is not `linkedin`. Allowed MIME types: `video/mp4`, `video/quicktime`. Up to 20 MB per file, and up to 6 items total combined with `images`."
                  }
                },
                "required": [
                  "leadId",
                  "type",
                  "assignedTo",
                  "dueDate"
                ]
              },
              "example": {
                "type": "phone",
                "assignedTo": "usr_7YzNqVRMCfdeHEzMn",
                "dueDate": "2025-02-10T09:58:57.169Z",
                "message": "this is my message",
                "title": "this is my title",
                "leadId": "lea_zUwSUPSxozD9fLVGw"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                },
                "example": {
                  "_id": "opp_LyXDV8KHzctQdLFpG",
                  "type": "manual",
                  "title": "Keep an eye on him",
                  "priority": 1,
                  "leadId": "lea_fiDpiGV585wy3Oii2",
                  "campaignId": "cam_bSn8EORHQxbWPjHvu",
                  "contactId": "ctc_xW8Ou6C03Csv8vatp",
                  "dueDate": "2025-11-10T09:58:57.169Z",
                  "userId": "usr_ahfFktBBHUIxbVG5P",
                  "content": "does he have bandwidth to help us? would be grand"
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / Bad method",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        },
        "parameters": []
      },
      "patch": {
        "summary": "Update Task",
        "description": "Update task details such as assignment, due date, title, message, priority, or completion status.",
        "tags": [
          "Tasks"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "The unique identifier of the task to update"
                  },
                  "assignedTo": {
                    "type": "string",
                    "description": "The ID of the team member to assign the task to (userId)"
                  },
                  "dueDate": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Updated due date in ISO 8601 format"
                  },
                  "title": {
                    "type": "string",
                    "description": "Updated task title"
                  },
                  "message": {
                    "type": "string",
                    "description": "Updated task message/description"
                  },
                  "priority": {
                    "type": "string",
                    "description": "Priority level of the task",
                    "enum": [
                      "",
                      "0",
                      "1",
                      "2"
                    ]
                  },
                  "done": {
                    "type": "boolean",
                    "description": "Mark task as completed"
                  },
                  "images": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uri"
                    },
                    "description": "Public HTTPS URLs of images to attach to a LinkedIn task. Replaces the task's current images — pass an empty array to clear them. Returns `400` (`LINKEDIN_MEDIA_INVALID_TYPE`) when the target task is not a LinkedIn task. Allowed MIME types: `image/png`, `image/jpeg`, `image/gif`. Up to 20 MB per file, and up to 6 items total combined with `videos`."
                  },
                  "videos": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uri"
                    },
                    "description": "Public HTTPS URLs of videos to attach to a LinkedIn task. Replaces the task's current videos — pass an empty array to clear them. Returns `400` (`LINKEDIN_MEDIA_INVALID_TYPE`) when the target task is not a LinkedIn task. Allowed MIME types: `video/mp4`, `video/quicktime`. Up to 20 MB per file, and up to 6 items total combined with `images`."
                  }
                },
                "required": [
                  "id"
                ]
              },
              "example": {
                "id": "opp_0Ieq2qRMg5EIeUMFV",
                "title": "My new title"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Task"
                },
                "example": {
                  "_id": "opp_KNQOrrlGnLvEXDDS9",
                  "type": "manual",
                  "title": "Check him out",
                  "priority": 2,
                  "dueDate": "2025-10-31T07:58:00.000Z",
                  "userId": "usr_ahfFktBBHUIxbVG5P",
                  "content": "Really glad we started using lemlist"
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / Bad method",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        },
        "parameters": []
      }
    },
    "/tasks/ignore": {
      "post": {
        "summary": "Ignore Tasks",
        "tags": [
          "Tasks"
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Array of task IDs to ignore"
                  }
                },
                "required": [
                  "ids"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {}
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / Error message from opportunitiesDone",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/inbox": {
      "get": {
        "summary": "Get Many Inboxes",
        "tags": [
          "Inbox"
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "The page number to retrieve",
            "example": "1",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "The maximum number of records to return",
            "example": "2",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "userId",
            "in": "query",
            "required": true,
            "description": "Filter by user ID",
            "example": "usr_dG0cI7mRz7wadvioF",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/InboxConversation"
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "totalItems": {
                          "type": "integer"
                        },
                        "currentPage": {
                          "type": "integer"
                        },
                        "nextPage": {
                          "type": "integer",
                          "nullable": true
                        },
                        "previousPage": {
                          "type": "integer",
                          "nullable": true
                        },
                        "perPage": {
                          "type": "integer"
                        },
                        "totalPages": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "_id": "ibx_RsROKFC3gmowgc74P",
                      "opportunities": [],
                      "lastActivityAt": "2024-12-17T09:42:32.971Z",
                      "createdBy": "act_gKmkJOLCfUl4TkhIl",
                      "channels": [
                        "email"
                      ],
                      "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                      "contactId": "ctc_Ds0IaxECSACsbLMzA",
                      "users": [
                        {
                          "userId": "usr_xtJHBMYJSOHzI3ZFb",
                          "sender": true,
                          "read": true
                        },
                        {
                          "userId": "usr_bcPQCObkKptmHw2Rp",
                          "sender": true,
                          "read": true
                        }
                      ],
                      "createdAt": "2024-12-03T09:52:55.466Z",
                      "haveReplies": true,
                      "lastRepliedAt": "2024-12-03T10:12:20.620Z",
                      "lastRepliedChannel": "email",
                      "contact": {
                        "_id": "ctc_Ds0IaxECSACsbLMzA",
                        "fullName": "Alex",
                        "email": "alex@example.com"
                      }
                    },
                    {
                      "_id": "ibx_M1qunaOcugoqSEnNY",
                      "opportunities": [],
                      "lastActivityAt": "2024-12-17T09:42:30.430Z",
                      "createdBy": "act_AzW7OkDzo7GZzfBYq",
                      "channels": [
                        "email"
                      ],
                      "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                      "contactId": "ctc_p66lDxuCdb9ZUMSN2",
                      "users": [
                        {
                          "userId": "usr_xtJHBMYJSOHzI3ZFb",
                          "sender": true,
                          "read": false
                        },
                        {
                          "userId": "usr_bcPQCObkKptmHw2Rp",
                          "sender": true,
                          "read": true
                        }
                      ],
                      "createdAt": "2024-12-03T14:01:15.873Z",
                      "haveReplies": true,
                      "lastRepliedAt": "2024-12-03T14:14:00.848Z",
                      "lastRepliedChannel": "email",
                      "contact": {
                        "_id": "ctc_p66lDxuCdb9ZUMSN2",
                        "email": "casey@example.com"
                      }
                    },
                    {
                      "_id": "ibx_6vBhQEot19XAsTKvr",
                      "opportunities": [],
                      "lastActivityAt": "2024-12-17T09:42:17.682Z",
                      "createdBy": "act_38dXN8dzn6D8LU9dp",
                      "channels": [
                        "email"
                      ],
                      "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                      "contactId": "ctc_rtlWNMHykdtwjih7i",
                      "users": [
                        {
                          "userId": "usr_xtJHBMYJSOHzI3ZFb",
                          "sender": true,
                          "read": true
                        },
                        {
                          "userId": "usr_bcPQCObkKptmHw2Rp",
                          "sender": true,
                          "read": true
                        }
                      ],
                      "createdAt": "2024-12-02T16:27:50.927Z",
                      "haveReplies": true,
                      "lastRepliedAt": "2024-12-02T16:38:35.875Z",
                      "lastRepliedChannel": "email",
                      "contact": {
                        "_id": "ctc_rtlWNMHykdtwjih7i",
                        "email": "morgan@example.com"
                      }
                    },
                    {
                      "_id": "ibx_wemRUwJQXZLRTjG8F",
                      "opportunities": [],
                      "lastActivityAt": "2024-12-04T16:58:53.629Z",
                      "createdBy": "act_GjM4hNyXjAm29XGa2",
                      "channels": [
                        "email"
                      ],
                      "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                      "contactId": "ctc_POL1cAPMvKzr851KU",
                      "users": [
                        {
                          "userId": "usr_xtJHBMYJSOHzI3ZFb",
                          "sender": true,
                          "read": true
                        },
                        {
                          "userId": "usr_bcPQCObkKptmHw2Rp",
                          "sender": true,
                          "read": true
                        }
                      ],
                      "createdAt": "2024-11-29T11:40:17.918Z",
                      "haveReplies": true,
                      "lastRepliedAt": "2024-12-04T15:47:00.816Z",
                      "lastRepliedChannel": "email",
                      "contact": {
                        "_id": "ctc_POL1cAPMvKzr851KU",
                        "fullName": "Jordan",
                        "email": "jordan@example.com"
                      }
                    }
                  ],
                  "pagination": {
                    "totalItems": 4,
                    "currentPage": 1,
                    "nextPage": null,
                    "previousPage": null,
                    "perPage": 10,
                    "totalPages": 1
                  }
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / User ID is required / User not in team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/inbox/{contactId}": {
      "parameters": [
        {
          "name": "contactId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the contact",
          "example": "ctc_ei6zVayP9B2ugwUPN",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "summary": "Get Contact Messages",
        "tags": [
          "Inbox"
        ],
        "parameters": [
          {
            "name": "userId",
            "in": "query",
            "required": false,
            "description": "ID of the user viewing the conversation",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "The maximum number of records to return",
            "example": "10",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "skip",
            "in": "query",
            "required": false,
            "description": "Number of items to skip. Default: 0",
            "example": "1",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "markAsRead",
            "in": "query",
            "required": false,
            "description": "When true, marks the conversation as read. Default: false",
            "example": "true",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/InboxMessage"
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "totalItems": {
                          "type": "integer"
                        },
                        "currentPage": {
                          "type": "integer"
                        },
                        "nextPage": {
                          "type": "integer",
                          "nullable": true
                        },
                        "previousPage": {
                          "type": "integer",
                          "nullable": true
                        },
                        "perPage": {
                          "type": "integer"
                        },
                        "totalPages": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "_id": "act_vQJUQw4OMGqp25aTi",
                      "type": "emailsSent",
                      "messageId": "<CAPLqhUKnWmszLsJxMO3osKL7YgU3-b_5kC+f4SvqYOVfzRc28g@mail.gmail.com>",
                      "createdAt": "2024-12-05T16:39:41.416Z",
                      "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                      "leadId": "lea_tmOgcDHB5wWwStNtN",
                      "campaignId": "cam_pijDVnytN5S7frriD",
                      "sequenceId": "seq_KnckIbUtWVFAsdCBG",
                      "sequenceStep": 0,
                      "sendUserId": "usr_bcPQCObkKptmHw2Rp",
                      "sendUserName": "Alex DOE",
                      "sendUserEmail": "alex.doe@example.com",
                      "sendUserMailboxId": "usm_05P73WrvTqHY8OAee",
                      "leadEmail": "alex@example.com",
                      "contactId": "ctc_Ds0IaxECSACsbLMzA",
                      "message": "<html><div style=\"min-width: 360px\"></div><div dir=\"ltr\">\n    <div>Hello lemlist Team! 😎<br style=\"box-sizing: border-box;\"><br style=\"box-sizing: border-box;\">I joined lemlist last Monday, and I am humbly offering you the chance to meet me (and probably my cat, Megatron 😽🤖) through a 15-minute call at your convenience! You can book it <span style=\"cursor: pointer; background: var(--tertiary2-color-100); color: var(--alert); box-sizing: border-box;\" data-error=\"true\">[here]</span>(https://app.lemcal.com/@alex-doe/quick-meeting?leadId=lea_tmOgcDHB5wWwStNtN).<br style=\"box-sizing: border-box;\"><br style=\"box-sizing: border-box;\">See you soon!<br style=\"box-sizing: border-box;\"><br style=\"box-sizing: border-box;\">Alex DOE</div>\n    <div class=\"gmail_extra\">\n      <div class=\"gmail_signature\" data-smartmail=\"gmail_signature\"><div dir=\"ltr\"><div><div dir=\"ltr\"></div></div></div></div>\n      \n    </div>\n    </div>\n<span summary=\"/api/reply/data-ll-tsk_lxY7QI0bYAop5cPBU\"></span>\n<img alt=\"logo\" src=\"https://zr0.lemlst.org/api/track/open/usr_bcPQCObkKptmHw2Rp/tsk_lxY7QI0bYAop5cPBU\" height=\"1\" width=\"1\"></html>",
                      "subject": "Meet me !",
                      "attachments": []
                    },
                    {
                      "_id": "act_HXQTqg6L29jdy3b6K",
                      "type": "emailsReplied",
                      "messageId": "<CAKs+3EYjH0POGz0H-rS1XHH1YnG9LtN2m4y8LocddFWWMm8HBw@mail.gmail.com>",
                      "createdAt": "2024-12-03T10:10:45.000Z",
                      "fromEmail": "alex@example.com",
                      "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                      "leadId": "lea_lzfQLRbKAZdKvjCwg",
                      "campaignId": "cam_UBbMt30jHq0vNJKJr",
                      "sequenceId": "seq_ZDRIjDniOznJJLcKO",
                      "sequenceStep": 0,
                      "sendUserId": "usr_xtJHBMYJSOHzI3ZFb",
                      "sendUserName": "Jordan DOE",
                      "sendUserEmail": "jordan.doe@example.com",
                      "sendUserMailboxId": "usm_CT2BPoHic0I1cmitZ",
                      "leadEmail": "alex@example.com",
                      "contactId": "ctc_Ds0IaxECSACsbLMzA",
                      "message": "<div dir=\"ltr\">Haha Welcome Jordan, j&#39;adore cette campagne ! <br><br>A très vite, <div>Alex </div></div><br><div class=\"gmail_quote gmail_quote_container\"><div dir=\"ltr\" class=\"gmail_attr\">On Tue, Dec 3, 2024 at 10:52 AM Jordan DOE &lt;<a href=\"mailto:jordan.doe@example.com\">jordan.doe@example.com</a>&gt; wrote:<br></div><blockquote class=\"gmail_quote\" style=\"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex\"><div style=\"min-width:360px\"></div><div dir=\"ltr\">\n    <div><p style=\"margin:0px;box-sizing:border-box\">Hey Alex  , </p><p style=\"margin:0px;box-sizing:border-box\"><br style=\"box-sizing:border-box\"></p><p style=\"margin:0px;box-sizing:border-box\">I hope this email finds you well!</p><p style=\"margin:0px;box-sizing:border-box\"><br style=\"box-sizing:border-box\"></p><p style=\"margin:0px;box-sizing:border-box\">Have you ever heard about Jordan Doe? <br> <br>🇫🇷 He was a member of the French Parliament during the French Revolution, <br>🏘️ He has a street named after him<br><strong style=\"font-weight:700;box-sizing:border-box\">📙 </strong>He authored the famous &quot;Beurre frais épuré, et conservant longtemps ses bonnes qualités, sans devenir rance&quot;.<br style=\"box-sizing:border-box\"><br style=\"box-sizing:border-box\"><img width=\"134\" style=\"width: 134px; display: block; vertical-align: top; margin: 5px auto; text-align: center; border-style: none; padding: 0px 1px; box-sizing: border-box;\" src=\"https://zr0.lemlst.org/api/files/Files/fil_3WlQwHwsxgZZCRnu3.png\"></p><p style=\"margin:0px;box-sizing:border-box\"><br style=\"box-sizing:border-box\"></p><p style=\"margin:0px;box-sizing:border-box\">Unfortunately, this brilliant man died ages ago...</p><p style=\"margin:0px;box-sizing:border-box\"><br style=\"box-sizing:border-box\"></p><p style=\"margin:0px;box-sizing:border-box\">But wait, there&#39;s another Jordan Doe you might be interested in meeting—one who is very much alive and well! Yes, that&#39;s me. I&#39;ve just joined Lemlist, and I&#39;m looking forward to meeting everyone for a quick chat.</p><p style=\"margin:0px;box-sizing:border-box\"><br style=\"box-sizing:border-box\"></p><p style=\"margin:0px;box-sizing:border-box\">☑️ Book an appointment on 📅 <a style=\"color:rgb(51,138,241);text-decoration:none;background-color:transparent;box-sizing:border-box;font-weight:500\" href=\"https://app.lemcal.com/@jordan-doe/15-min-chat?leadId=lea_lzfQLRbKAZdKvjCwg\" target=\"_blank\">my lemcal</a> !</p><p style=\"margin:0px;box-sizing:border-box\"><br></p><p style=\"margin:0px;box-sizing:border-box\">Feel free to reach out and get to know me better. I'm excited to be part of the team and eager to contribute to our collective success.</p><p style=\"margin:0px;box-sizing:border-box\">Looking forward to seeing you all soon!<br style=\"box-sizing:border-box\"><br style=\"box-sizing:border-box\">Best regards, as your contemporary, Jordan Doe</p></div>\n    <div class=\"gmail_extra\">\n      <div class=\"gmail_signature\"><div dir=\"ltr\"><div><div dir=\"ltr\"></div></div></div></div>\n      \n    </div>\n    </div>\n<span summary=\"/api/reply/data-ll-tsk_IMjjv5uq8YIsjuDSw\"></span>\n<img alt=\"logo\" src=\"https://zr0.lemlst.org/api/track/open/usr_xtJHBMYJSOHzI3ZFb/tsk_IMjjv5uq8YIsjuDSw\" height=\"1\" width=\"1\">\n</blockquote></div>\n",
                      "subject": "Re: Have you heard about Jordan Doe ?",
                      "attachments": []
                    },
                    {
                      "_id": "act_gKmkJOLCfUl4TkhIl",
                      "type": "emailsSent",
                      "messageId": "<CADuPnhJfe0BDrR47w4DNsvQT9kStS3DHQ9B4cP2=8AciE_M42w@mail.gmail.com>",
                      "createdAt": "2024-12-03T09:52:55.319Z",
                      "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                      "leadId": "lea_lzfQLRbKAZdKvjCwg",
                      "campaignId": "cam_UBbMt30jHq0vNJKJr",
                      "sequenceId": "seq_ZDRIjDniOznJJLcKO",
                      "sequenceStep": 0,
                      "sendUserId": "usr_xtJHBMYJSOHzI3ZFb",
                      "sendUserName": "Jordan DOE",
                      "sendUserEmail": "jordan.doe@example.com",
                      "sendUserMailboxId": "usm_CT2BPoHic0I1cmitZ",
                      "leadEmail": "alex@example.com",
                      "contactId": "ctc_Ds0IaxECSACsbLMzA",
                      "message": "<html><div style=\"min-width: 360px\"></div><div dir=\"ltr\">\n    <div><p style=\"margin: 0px; box-sizing: border-box;\">Hey Alex  ,&nbsp;</p><p style=\"margin: 0px; box-sizing: border-box;\"><br style=\"box-sizing: border-box;\"></p><p style=\"margin: 0px; box-sizing: border-box;\">I hope this email finds you well!</p><p style=\"margin: 0px; box-sizing: border-box;\"><br style=\"box-sizing: border-box;\"></p><p style=\"margin: 0px; box-sizing: border-box;\">Have you ever heard about Jordan Doe? <br> <br>🇫🇷 He was a member of the French Parliament during the French Revolution, <br>🏘️ He has a street named after him<br><strong style=\"font-weight: 700; box-sizing: border-box;\">📙&nbsp;</strong>He authored the famous \"Beurre frais épuré, et conservant longtemps ses bonnes qualités, sans devenir rance\".<br style=\"box-sizing: border-box;\"><br style=\"box-sizing: border-box;\"><img  width=\"134\" style=\"width: 134px; display: block; vertical-align: top; margin: 5px auto; text-align: center; border-style: none; cursor: pointer; padding: 0px 1px; box-sizing: border-box;\" src=\"https://zr0.lemlst.org/api/files/Files/fil_3WlQwHwsxgZZCRnu3.png\"></p><p style=\"margin: 0px; box-sizing: border-box;\"><br style=\"box-sizing: border-box;\"></p><p style=\"margin: 0px; box-sizing: border-box;\">Unfortunately, this brilliant man died ages ago...</p><p style=\"margin: 0px; box-sizing: border-box;\"><br style=\"box-sizing: border-box;\"></p><p style=\"margin: 0px; box-sizing: border-box;\">But wait, there's another Jordan Doe you might be interested in meeting—one who is very much alive and well! Yes, that's me. I've just joined Lemlist, and I'm looking forward to meeting everyone for a quick chat.</p><p style=\"margin: 0px; box-sizing: border-box;\"><br style=\"box-sizing: border-box;\"></p><p style=\"margin: 0px; box-sizing: border-box;\">☑️ Book an appointment on 📅 <a style=\"color: rgb(51, 138, 241); text-decoration: none; background-color: transparent; user-select: auto; box-sizing: border-box; font-weight: 500;\" href=\"https://app.lemcal.com/@jordan-doe/15-min-chat?leadId=lea_lzfQLRbKAZdKvjCwg\">my lemcal</a> !</p><p style=\"margin: 0px; box-sizing: border-box;\"><br></p><p style=\"margin: 0px; box-sizing: border-box;\">Feel free to reach out and get to know me better. I'm excited to be part of the team and eager to contribute to our collective success.</p><p style=\"margin: 0px; box-sizing: border-box;\">Looking forward to seeing you all soon!<br style=\"box-sizing: border-box;\"><br style=\"box-sizing: border-box;\">Best regards, as your contemporary, Jordan Doe</p></div>\n    <div class=\"gmail_extra\">\n      <div class=\"gmail_signature\" data-smartmail=\"gmail_signature\"><div dir=\"ltr\"><div><div dir=\"ltr\"></div></div></div></div>\n      \n    </div>\n    </div>\n<span summary=\"/api/reply/data-ll-tsk_IMjjv5uq8YIsjuDSw\"></span>\n<img alt=\"logo\" src=\"https://zr0.lemlst.org/api/track/open/usr_xtJHBMYJSOHzI3ZFb/tsk_IMjjv5uq8YIsjuDSw\" height=\"1\" width=\"1\"></html>",
                      "subject": "Have you heard about Jordan Doe  ?",
                      "attachments": []
                    }
                  ],
                  "pagination": {
                    "totalItems": 3,
                    "currentPage": 1,
                    "nextPage": null,
                    "previousPage": null,
                    "perPage": 10,
                    "totalPages": 1
                  }
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / Invalid contactId / Invalid userId / User not in team / User ID is required to mark as read",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/inbox/email": {
      "post": {
        "summary": "Send Email",
        "tags": [
          "Inbox"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sendUserId": {
                    "type": "string",
                    "description": "Sender user ID"
                  },
                  "sendUserEmail": {
                    "type": "string",
                    "description": "Sender email address"
                  },
                  "sendUserMailboxId": {
                    "type": "string",
                    "description": "Sender mailbox ID"
                  },
                  "contactId": {
                    "type": "string",
                    "description": "Contact ID. Provide either contactId or leadId (not both required). Returned in the response."
                  },
                  "leadId": {
                    "type": "string",
                    "description": "Lead ID. Provide either contactId or leadId; when only leadId is sent, its contact is resolved and returned as contactId in the response."
                  },
                  "subject": {
                    "type": "string",
                    "description": "Email subject. Required for a standalone email; on a reply (replyToActivityId set) omit to reuse the thread's subject."
                  },
                  "message": {
                    "type": "string",
                    "description": "Email message (HTML)"
                  },
                  "cc": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "CC email addresses. On a reply, omit to inherit the thread's CC; pass a list to override, or an empty array to send without CC."
                  },
                  "replyToActivityId": {
                    "type": "string",
                    "description": "Reply within an existing email thread. Pass a specific email activity ID (act_...) or \"latest\" for the contact's most recent email. Threads the message (In-Reply-To) and reuses the thread's subject. Omit to send a standalone email. If \"latest\" and the contact has no prior email, a standalone email is sent."
                  }
                },
                "required": [
                  "sendUserId",
                  "sendUserEmail",
                  "sendUserMailboxId",
                  "message"
                ]
              },
              "example": {
                "sendUserId": "usr_FU6yAd3UdBFel0UDy",
                "sendUserEmail": "john@example.com",
                "sendUserMailboxId": "usm_pmZsNNO1gl5nwCQ07",
                "contactId": "ctc_ei6zVayP9B2ugwUPN",
                "leadId": "lea_wadZOcDDSFWSbFaCf",
                "subject": "Follow up",
                "message": "<p>Hello,</p><p>Following up on our conversation...</p>",
                "cc": [],
                "replyToActivityId": "latest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "description": "True when the email was sent."
                    },
                    "contactId": {
                      "type": "string",
                      "description": "The contact the email was sent to (resolved from leadId when only a lead was provided)."
                    }
                  },
                  "additionalProperties": true
                },
                "example": {
                  "ok": true,
                  "contactId": "ctc_JgrwGbHKgFoEnunBA"
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / Invalid sendUserId / Invalid sendUserEmail / Invalid sendUserMailboxId / contactId or leadId is required / Invalid leadId / Lead not found / Failed to send email",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        },
        "parameters": []
      }
    },
    "/inbox/linkedin": {
      "post": {
        "summary": "Send LinkedIn Message",
        "tags": [
          "Inbox"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sendUserId": {
                    "type": "string",
                    "description": "Sender user ID"
                  },
                  "leadId": {
                    "type": "string",
                    "description": "Lead ID"
                  },
                  "contactId": {
                    "type": "string",
                    "description": "Contact ID"
                  },
                  "message": {
                    "type": "string",
                    "description": "Message content"
                  }
                },
                "required": [
                  "sendUserId",
                  "leadId",
                  "contactId",
                  "message"
                ]
              },
              "example": {
                "sendUserId": "usr_FU6yAd3UdBFel0UDy",
                "leadId": "lea_wadZOcDDSFWSbFaCf",
                "contactId": "ctc_ei6zVayP9B2ugwUPN",
                "message": "Hi, I wanted to follow up..."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / Invalid sendUserId / contactId or leadId is required / Invalid leadId / Lead not found / Invalid contactId / Failed to send message",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        },
        "parameters": []
      }
    },
    "/inbox/whatsapp": {
      "post": {
        "summary": "Send WhatsApp Message",
        "tags": [
          "Inbox"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sendUserId": {
                    "type": "string",
                    "description": "Sender user ID"
                  },
                  "sendUserWhatsappAccountId": {
                    "type": "string",
                    "description": "WhatsApp account ID"
                  },
                  "contactId": {
                    "type": "string",
                    "description": "Contact ID"
                  },
                  "leadId": {
                    "type": "string",
                    "description": "Lead ID"
                  },
                  "message": {
                    "type": "string",
                    "description": "Message content"
                  }
                },
                "required": [
                  "sendUserId",
                  "sendUserWhatsappAccountId",
                  "contactId",
                  "leadId",
                  "message"
                ]
              },
              "example": {
                "sendUserId": "usr_FU6yAd3UdBFel0UDy",
                "sendUserWhatsappAccountId": "wha_ABC123",
                "contactId": "ctc_ei6zVayP9B2ugwUPN",
                "leadId": "lea_wadZOcDDSFWSbFaCf",
                "message": "Hi, following up on our conversation"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          },
          "400": {
            "description": "Possible errors: Bad team / Invalid sendUserId / Invalid sendUserWhatsappAccountId / contactId or leadId is required / Invalid leadId / Lead not found / Failed to send whatsapp message",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        },
        "parameters": []
      }
    },
    "/inbox/labels": {
      "get": {
        "summary": "Get Many Labels",
        "description": "List all labels available to your team.",
        "tags": [
          "Inbox"
        ],
        "responses": {
          "200": {
            "description": "Success - Returns array of labels",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Label"
                  }
                },
                "example": [
                  {
                    "_id": "lbl_uPAAgsi4oi9juBHfW",
                    "name": "Interested",
                    "color": "#F9A2A2",
                    "createdAt": "2025-11-26T15:49:23.470Z",
                    "createdBy": "john.doe@example.com"
                  }
                ]
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          }
        },
        "parameters": []
      },
      "post": {
        "summary": "Create Label",
        "description": "Creates a new label available to the team.",
        "tags": [
          "Inbox"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "labelName": {
                    "type": "string",
                    "description": "Name of the label to create"
                  }
                },
                "required": [
                  "labelName"
                ]
              },
              "example": {
                "labelName": "Interested"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success - Label created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Label"
                },
                "example": {
                  "_id": "lbl_uPAAgsi4oi9juBHfW",
                  "name": "Interested",
                  "color": "#F9A2A2",
                  "createdAt": "2025-11-26T15:49:23.470Z"
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / labelName is required / Failed to create label",
            "content": {
              "text/plain": {
                "example": "labelName is required"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "409": {
            "description": "Label with this name already exists",
            "content": {
              "text/plain": {
                "example": "Label with this name already exists"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        },
        "parameters": []
      }
    },
    "/inbox/labels/{labelId}": {
      "get": {
        "summary": "Get Label",
        "description": "Get info of a specific label.",
        "tags": [
          "Inbox"
        ],
        "parameters": [
          {
            "name": "labelId",
            "in": "path",
            "required": true,
            "description": "Label ID",
            "example": "lbl_uPAAgsi4oi9juBHfW",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Label"
                },
                "example": {
                  "_id": "lbl_uPAAgsi4oi9juBHfW",
                  "name": "Interested",
                  "color": "#F9A2A2",
                  "createdAt": "2025-11-26T15:49:23.470Z",
                  "createdBy": "john.doe@example.com"
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "404": {
            "description": "Label not found",
            "content": {
              "text/plain": {
                "example": "Label not found"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/inbox/conversations/labels/{contactId}": {
      "post": {
        "summary": "Attach Labels to Conversations",
        "description": "Attaches one or more labels to one or more conversations.",
        "tags": [
          "Inbox"
        ],
        "parameters": [
          {
            "name": "contactId",
            "in": "path",
            "required": true,
            "description": "Contact ID",
            "example": "ctc_ei6zVayP9B2ugwUPN",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "labelIds": {
                    "type": "array",
                    "description": "Array of label IDs to attach",
                    "items": {
                      "type": "string"
                    }
                  },
                  "appendLabels": {
                    "type": "boolean",
                    "description": "If true, appends labels to existing ones. If false, replaces all labels."
                  }
                },
                "required": [
                  "labelIds",
                  "appendLabels"
                ]
              },
              "example": {
                "labelIds": [
                  "lbl_uPAAgsi4oi9juBHfW",
                  "lbl_oZCShmPCP2L43b8qf"
                ],
                "appendLabels": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / Invalid request body: labelIds must be an array and appendLabels must be a boolean",
            "content": {
              "text/plain": {
                "example": "Invalid request body: labelIds must be an array and appendLabels must be a boolean"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "404": {
            "description": "Possible errors: Inbox not found / Label not found",
            "content": {
              "text/plain": {
                "example": "Label not found"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      },
      "delete": {
        "summary": "Remove Labels from Conversation",
        "description": "Removes one or more labels from one conversation.",
        "tags": [
          "Inbox"
        ],
        "parameters": [
          {
            "name": "contactId",
            "in": "path",
            "required": true,
            "description": "Contact ID",
            "example": "ctc_ei6zVayP9B2ugwUPN",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "labelIds": {
                    "type": "array",
                    "description": "Array of label IDs to remove",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "labelIds"
                ]
              },
              "example": {
                "labelIds": [
                  "lbl_uPAAgsi4oi9juBHfW"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / Invalid request body: labelIds must be an array",
            "content": {
              "text/plain": {
                "example": "Invalid request body: labelIds must be an array"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "404": {
            "description": "Possible errors: Inbox not found / Label not found",
            "content": {
              "text/plain": {
                "example": "Label not found"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/inbox/{contactId}/drafts": {
      "get": {
        "summary": "List Drafts",
        "description": "Lists all non-deleted drafts for a specific contact.",
        "tags": [
          "Inbox"
        ],
        "parameters": [
          {
            "name": "contactId",
            "in": "path",
            "required": true,
            "description": "Contact ID",
            "example": "ctc_ei6zVayP9B2ugwUPN",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "draftOwner",
            "in": "query",
            "required": true,
            "description": "Draft owner identifier. Accepts either a userId (e.g., `usr_abc123def456789`) or a login email (e.g., `john@acme.com`).",
            "example": "usr_abc123def456789",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "drafts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "_id": {
                            "type": "string",
                            "description": "Unique draft identifier"
                          },
                          "channel": {
                            "type": "string",
                            "enum": [
                              "email",
                              "linkedin",
                              "whatsapp",
                              "sms"
                            ],
                            "description": "Communication channel"
                          },
                          "subject": {
                            "type": "string",
                            "description": "Draft subject"
                          },
                          "contentPreview": {
                            "type": "string",
                            "description": "Content preview (max 100 chars)"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "api",
                              "ui"
                            ],
                            "description": "Draft creation source"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time",
                            "description": "Creation date"
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time",
                            "description": "Last update date"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "drafts": [
                    {
                      "_id": "drf_abc123def456789",
                      "channel": "email",
                      "subject": "Follow up on our meeting",
                      "contentPreview": "Hi John, I wanted to follow up on our conversation from last week...",
                      "source": "api",
                      "createdAt": "2025-01-15T10:30:00.000Z",
                      "updatedAt": "2025-01-15T10:30:00.000Z"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Missing draftOwner / User not found",
            "content": {
              "text/plain": {
                "example": "User not found: neither a valid email nor a valid user id for this team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      },
      "post": {
        "summary": "Create Draft",
        "description": "Creates a new draft for a specific contact. The source is automatically set to \"api\".",
        "tags": [
          "Inbox"
        ],
        "parameters": [
          {
            "name": "contactId",
            "in": "path",
            "required": true,
            "description": "Contact ID",
            "example": "ctc_ei6zVayP9B2ugwUPN",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "draftOwner",
            "in": "query",
            "required": true,
            "description": "Draft owner identifier. Accepts either a userId (e.g., `usr_abc123def456789`) or a login email (e.g., `john@acme.com`).",
            "example": "usr_abc123def456789",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "channel": {
                    "type": "string",
                    "enum": [
                      "email",
                      "linkedin",
                      "whatsapp",
                      "sms"
                    ],
                    "description": "Communication channel"
                  },
                  "content": {
                    "type": "string",
                    "description": "Draft content (max 30KB)"
                  },
                  "subject": {
                    "type": "string",
                    "description": "Draft subject (optional)"
                  },
                  "cc": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "CC email addresses (optional)"
                  },
                  "attachments": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "description": "Attachment file name"
                        },
                        "url": {
                          "type": "string",
                          "description": "Attachment URL"
                        },
                        "size": {
                          "type": "integer",
                          "description": "File size in bytes"
                        },
                        "type": {
                          "type": "string",
                          "description": "MIME type"
                        }
                      }
                    },
                    "description": "File attachments (optional)"
                  },
                  "replyToActivityId": {
                    "type": "string",
                    "description": "Activity ID to reply to (optional)"
                  },
                  "sourceMetadata": {
                    "type": "object",
                    "description": "Additional metadata (optional)"
                  }
                },
                "required": [
                  "channel",
                  "content"
                ]
              },
              "example": {
                "channel": "email",
                "content": "<p>Hello John, I wanted to follow up on our conversation.</p>",
                "subject": "Follow up on our meeting",
                "cc": [],
                "attachments": []
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Draft created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "draftId": {
                      "type": "string",
                      "description": "ID of the created draft"
                    }
                  }
                },
                "example": {
                  "draftId": "drf_abc123def456789"
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Missing draftOwner / Invalid channel / Content must not be empty / Content too large / Draft limit reached (max 10 per conversation) / User not found",
            "content": {
              "text/plain": {
                "example": "Content must not be empty"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/inbox/{contactId}/drafts/{draftId}": {
      "get": {
        "summary": "Get Draft",
        "description": "Retrieves a single draft with its full content, including attachments.",
        "tags": [
          "Inbox"
        ],
        "parameters": [
          {
            "name": "contactId",
            "in": "path",
            "required": true,
            "description": "Contact ID",
            "example": "ctc_ei6zVayP9B2ugwUPN",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "draftId",
            "in": "path",
            "required": true,
            "description": "Draft ID",
            "example": "drf_abc123def456789",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "draftOwner",
            "in": "query",
            "required": true,
            "description": "Draft owner identifier. Accepts either a userId (e.g., `usr_abc123def456789`) or a login email (e.g., `john@acme.com`).",
            "example": "usr_abc123def456789",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "draft": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string",
                          "description": "Unique draft identifier"
                        },
                        "channel": {
                          "type": "string",
                          "enum": [
                            "email",
                            "linkedin",
                            "whatsapp",
                            "sms"
                          ],
                          "description": "Communication channel"
                        },
                        "subject": {
                          "type": "string",
                          "description": "Draft subject"
                        },
                        "cc": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "CC email addresses"
                        },
                        "content": {
                          "type": "string",
                          "description": "Full draft content"
                        },
                        "attachments": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "size": {
                                "type": "integer"
                              },
                              "type": {
                                "type": "string"
                              }
                            }
                          },
                          "description": "File attachments"
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "api",
                            "ui"
                          ],
                          "description": "Draft creation source"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time",
                          "description": "Creation date"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time",
                          "description": "Last update date"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "draft": {
                    "_id": "drf_abc123def456789",
                    "channel": "email",
                    "subject": "Follow up on our meeting",
                    "cc": [],
                    "content": "<p>Hello John, I wanted to follow up on our conversation.</p>",
                    "attachments": [],
                    "source": "api",
                    "createdAt": "2025-01-15T10:30:00.000Z",
                    "updatedAt": "2025-01-15T10:30:00.000Z"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Missing draftOwner / User not found",
            "content": {
              "text/plain": {
                "example": "User not found: neither a valid email nor a valid user id for this team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "404": {
            "description": "Draft not found",
            "content": {
              "text/plain": {
                "example": "Draft not found"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      },
      "patch": {
        "summary": "Update Draft",
        "description": "Partially updates an existing draft. Only the provided fields will be updated.",
        "tags": [
          "Inbox"
        ],
        "parameters": [
          {
            "name": "contactId",
            "in": "path",
            "required": true,
            "description": "Contact ID",
            "example": "ctc_ei6zVayP9B2ugwUPN",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "draftId",
            "in": "path",
            "required": true,
            "description": "Draft ID",
            "example": "drf_abc123def456789",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "draftOwner",
            "in": "query",
            "required": true,
            "description": "Draft owner identifier. Accepts either a userId (e.g., `usr_abc123def456789`) or a login email (e.g., `john@acme.com`).",
            "example": "usr_abc123def456789",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "subject": {
                    "type": "string",
                    "description": "Draft subject"
                  },
                  "cc": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "CC email addresses"
                  },
                  "content": {
                    "type": "string",
                    "description": "Draft content (max 30KB)"
                  },
                  "attachments": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "description": "Attachment file name"
                        },
                        "url": {
                          "type": "string",
                          "description": "Attachment URL"
                        },
                        "size": {
                          "type": "integer",
                          "description": "File size in bytes"
                        },
                        "type": {
                          "type": "string",
                          "description": "MIME type"
                        }
                      }
                    },
                    "description": "File attachments"
                  },
                  "replyToActivityId": {
                    "type": "string",
                    "description": "Activity ID to reply to"
                  }
                }
              },
              "example": {
                "subject": "Updated subject",
                "content": "<p>Updated content for the draft.</p>"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "draft": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string",
                          "description": "Unique draft identifier"
                        },
                        "channel": {
                          "type": "string",
                          "enum": [
                            "email",
                            "linkedin",
                            "whatsapp",
                            "sms"
                          ],
                          "description": "Communication channel"
                        },
                        "subject": {
                          "type": "string",
                          "description": "Draft subject"
                        },
                        "cc": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "CC email addresses"
                        },
                        "content": {
                          "type": "string",
                          "description": "Full draft content"
                        },
                        "attachments": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "size": {
                                "type": "integer"
                              },
                              "type": {
                                "type": "string"
                              }
                            }
                          },
                          "description": "File attachments"
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "api",
                            "ui"
                          ],
                          "description": "Draft creation source"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time",
                          "description": "Creation date"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time",
                          "description": "Last update date"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "draft": {
                    "_id": "drf_abc123def456789",
                    "channel": "email",
                    "subject": "Updated subject",
                    "cc": [],
                    "content": "<p>Updated content for the draft.</p>",
                    "attachments": [],
                    "source": "api",
                    "createdAt": "2025-01-15T10:30:00.000Z",
                    "updatedAt": "2025-01-15T11:00:00.000Z"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Missing draftOwner / Content must not be empty / Content too large / User not found",
            "content": {
              "text/plain": {
                "example": "Content must not be empty"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "404": {
            "description": "Draft not found",
            "content": {
              "text/plain": {
                "example": "Draft not found"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      },
      "delete": {
        "summary": "Delete Draft",
        "description": "Soft-deletes a draft by setting its deletedAt timestamp.",
        "tags": [
          "Inbox"
        ],
        "parameters": [
          {
            "name": "contactId",
            "in": "path",
            "required": true,
            "description": "Contact ID",
            "example": "ctc_ei6zVayP9B2ugwUPN",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "draftId",
            "in": "path",
            "required": true,
            "description": "Draft ID",
            "example": "drf_abc123def456789",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "draftOwner",
            "in": "query",
            "required": true,
            "description": "Draft owner identifier. Accepts either a userId (e.g., `usr_abc123def456789`) or a login email (e.g., `john@acme.com`).",
            "example": "usr_abc123def456789",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "success": true
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Missing draftOwner / User not found",
            "content": {
              "text/plain": {
                "example": "User not found: neither a valid email nor a valid user id for this team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "404": {
            "description": "Draft not found",
            "content": {
              "text/plain": {
                "example": "Draft not found"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/contacts": {
      "get": {
        "summary": "Get Many Contacts",
        "description": "Retrieves contacts by IDs/emails, or searches/lists contacts by name, email, contact list, campaign membership, or company link.\n\nWhen using `idsOrEmails`, returns an array of matching contacts directly.\n\nWhen using `search`, `email`, `listId`, `notInAnyCampaign`, any of the `company*` filters, or no filter at all, returns a paginated response with `data`, `total`, `limit`, and `offset` fields. You can combine filters together to narrow results (e.g. `listId` with `search`, or `notInAnyCampaign` with `companyId`). Calling the endpoint without any filter returns all contacts of the team, paginated.\n\nThe `company*` filters (`companyId`, `companyDomain`, `companyLinkedinUrl`, `companySalesnavUrl`) are mutually exclusive — use only one at a time. `companyDomain` / `companyLinkedinUrl` / `companySalesnavUrl` are resolved to a `companyId` through the Companies collection; if no matching company exists, the endpoint returns an empty list with `total: 0` (not an error), which keeps automation flows simple.",
        "tags": [
          "Contacts"
        ],
        "parameters": [
          {
            "name": "idsOrEmails",
            "in": "query",
            "required": false,
            "description": "A comma separated string of either valid contact IDs (MongoDB ObjectId) or valid email addresses. Optional — when omitted, returns the paginated list of all contacts of the team.",
            "example": "ctc_xW8Ou6C03Csv8vatp,riley@example.com",
            "schema": {
              "type": "string"
            },
            "style": "form",
            "explode": false
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Search contacts by name or other text fields. Must be at least 2 characters.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "email",
            "in": "query",
            "required": false,
            "description": "Search contacts by exact email address.",
            "schema": {
              "type": "string",
              "format": "email"
            }
          },
          {
            "name": "listId",
            "in": "query",
            "required": false,
            "description": "Filter contacts by contact list ID (`clt_xxx` format). Can be combined with `search` or `email`, or used alone to list all contacts in a list. Get valid IDs from `GET /contacts/lists`.",
            "example": "clt_abc123def456ghi78",
            "schema": {
              "type": "string",
              "pattern": "^clt_[a-zA-Z0-9]+$"
            }
          },
          {
            "name": "notInAnyCampaign",
            "in": "query",
            "required": false,
            "description": "When set to `true`, only returns contacts that are not part of any campaign (orphan contacts). Can be used alone or combined with other filters such as `search`, `email`, or `listId`.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "companyId",
            "in": "query",
            "required": false,
            "description": "Filter contacts by attached company ID (`cpn_xxx` format). Use this when you already know the lemlist company id (for example after fetching `GET /companies?crmSyncStatus=unique_index_error_company`). Mutually exclusive with `companyDomain`, `companyLinkedinUrl`, and `companySalesnavUrl`.",
            "example": "cpn_A1B2C3D4E5F6G7H8I",
            "schema": {
              "type": "string",
              "pattern": "^cpn_[a-zA-Z0-9]+$"
            }
          },
          {
            "name": "companyDomain",
            "in": "query",
            "required": false,
            "description": "Filter contacts by their company's website domain. Resolved to a `companyId` against the Companies collection. If no company matches, the endpoint returns an empty list (`total: 0`). Mutually exclusive with the other `company*` filters.",
            "example": "acme.com",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "companyLinkedinUrl",
            "in": "query",
            "required": false,
            "description": "Filter contacts by their company's LinkedIn URL. Resolved to a `companyId` against the Companies collection. If no company matches, the endpoint returns an empty list (`total: 0`). Mutually exclusive with the other `company*` filters.",
            "example": "https://www.linkedin.com/company/acme",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "companySalesnavUrl",
            "in": "query",
            "required": false,
            "description": "Filter contacts by their company's LinkedIn Sales Navigator URL. Resolved to a `companyId` against the Companies collection. If no company matches, the endpoint returns an empty list (`total: 0`). Mutually exclusive with the other `company*` filters.",
            "example": "https://www.linkedin.com/sales/company/12345678",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of contacts to return (1–500). Defaults to 100.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Number of contacts to skip for pagination. Defaults to 0.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. When using `idsOrEmails`, returns an array of contacts. Otherwise, returns a paginated object with `data`, `total`, `limit`, and `offset`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Contact"
                      }
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Contact"
                          }
                        },
                        "total": {
                          "type": "integer"
                        },
                        "limit": {
                          "type": "integer"
                        },
                        "offset": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "data",
                        "total",
                        "limit",
                        "offset"
                      ]
                    }
                  ]
                },
                "example": [
                  {
                    "_id": "ctc_xW8Ou6C03Csv8vatp",
                    "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                    "fullName": "John Doe",
                    "email": "support@lemlist.com",
                    "fields": {
                      "firstName": "John",
                      "jobTitle": "Growth Engineer",
                      "lastName": "Doe",
                      "industry": "Technology",
                      "isActiveInCampaigns": false,
                      "lastCampaign": "NEW TO DELETE",
                      "lastLeadMarkedAsInterestedDate": "2025-10-28T02:12:31.971Z",
                      "leadStatus": "Marked as not Interested by api"
                    },
                    "campaigns": [
                      {
                        "campaignId": "cam_bSn8EORHQxbWPjHvu",
                        "campaignState": "running",
                        "leadState": "review",
                        "leadId": "lea_fiDpiGV585wy3Oii2"
                      }
                    ],
                    "ownerId": "usr_ahfFktBBHUIxbVG5P",
                    "createdAt": "2025-10-28T00:40:37.917Z",
                    "createdBy": "usr_ahfFktBBHUIxbVG5P",
                    "unsubscribed": false
                  },
                  {
                    "_id": "ctc_a9RxJNa7pmMd85H9b",
                    "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                    "fullName": "Casey",
                    "email": "riley@example.com",
                    "fields": {
                      "firstName": "Casey",
                      "isActiveInCampaigns": false
                    },
                    "campaigns": [
                      {
                        "campaignId": "cam_jwm7THjgGFE3ylR85",
                        "campaignState": "running",
                        "leadState": "done",
                        "leadId": "lea_XKjAytuJhBKZhxhWh"
                      },
                      {
                        "campaignId": "cam_eF4DlNERV0CW1TwRd",
                        "campaignState": "running",
                        "leadState": "done",
                        "leadId": "lea_fJcS9D3UtEqZcDcAG"
                      },
                      {
                        "campaignId": "cam_UBbMt30jHq0vNJKJr",
                        "campaignState": "running",
                        "leadState": "done",
                        "leadId": "lea_GlaMfjxlUYuwEDL0w"
                      },
                      {
                        "campaignId": "cam_pijDVnytN5S7frriD",
                        "campaignState": "running",
                        "leadState": "review",
                        "leadId": "lea_Bs9aMGCcjdzTDvixY"
                      }
                    ],
                    "ownerId": "usr_Emu1g29BMtBixhMSP",
                    "createdAt": "2024-10-01T09:00:13.831Z",
                    "createdBy": "usr_Emu1g29BMtBixhMSP",
                    "unsubscribed": true
                  }
                ]
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / search query too short / invalid listId format",
            "content": {
              "text/plain": {
                "example": "Search query must be at least 2 characters"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      },
      "post": {
        "summary": "Add and update contact",
        "description": "Creates a new contact or updates an existing one (upsert). If a contact with the same email, LinkedIn URL, or Sales Navigator URL already exists, it will be updated with the provided non-empty fields. Null or empty values are ignored during updates to preserve existing data. You can target an existing contact directly by providing `contactId`, bypassing email/LinkedIn matching. You can optionally link the contact to a company by providing `companyId`, `companyDomain`, or `companyLinkedinUrl`.",
        "tags": [
          "Contacts"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "contactId": {
                    "type": "string",
                    "description": "Existing contact ID. Updates a specific contact by ID, bypassing email/LinkedIn matching. Can only be used to update an existing contact, not to create a new one. When provided, `email` and `linkedinUrl` are not required. At least one of `contactId`, `email`, `linkedinUrl`, or `linkedinUrlSalesNav` is required."
                  },
                  "email": {
                    "type": "string",
                    "description": "Contact email address. Used as a unique key for upsert matching. At least one of `contactId`, `email`, `linkedinUrl`, or `linkedinUrlSalesNav` is required."
                  },
                  "linkedinUrl": {
                    "type": "string",
                    "description": "LinkedIn profile URL. Used as an alternative unique key for upsert matching. At least one of `contactId`, `email`, `linkedinUrl`, or `linkedinUrlSalesNav` is required."
                  },
                  "linkedinUrlSalesNav": {
                    "type": "string",
                    "description": "LinkedIn Sales Navigator profile URL. Used as an alternative unique key for upsert matching."
                  },
                  "additionalEmails": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Additional email addresses for the contact. Each must be a valid email address."
                  },
                  "firstName": {
                    "type": "string",
                    "description": "Contact first name."
                  },
                  "lastName": {
                    "type": "string",
                    "description": "Contact last name."
                  },
                  "phone": {
                    "type": "string",
                    "description": "Contact phone number."
                  },
                  "jobTitle": {
                    "type": "string",
                    "description": "Contact job title. If a company is linked, this is saved as part of the job data."
                  },
                  "jobDescription": {
                    "type": "string",
                    "description": "Contact job description. If a company is linked, this is saved as part of the job data."
                  },
                  "picture": {
                    "type": "string",
                    "description": "URL of the contact's profile picture."
                  },
                  "timezone": {
                    "type": "string",
                    "description": "Contact timezone."
                  },
                  "industry": {
                    "type": "string",
                    "description": "Contact industry."
                  },
                  "languages": {
                    "type": "string",
                    "description": "Contact languages."
                  },
                  "location": {
                    "type": "string",
                    "description": "Contact location."
                  },
                  "skills": {
                    "type": "string",
                    "description": "Contact skills."
                  },
                  "summary": {
                    "type": "string",
                    "description": "Contact summary or bio."
                  },
                  "tagline": {
                    "type": "string",
                    "description": "Contact tagline."
                  },
                  "contactOwner": {
                    "type": "string",
                    "description": "Owner of the contact. Can be a user ID (e.g. `usr_...`) or a team member's email address. If the provided value does not match a team member, the owner defaults to the API key owner."
                  },
                  "source": {
                    "type": "string",
                    "description": "Origin of the contact record. Set on creation only and cannot be updated afterwards. Defaults to `api`.",
                    "default": "api"
                  },
                  "companyId": {
                    "type": "string",
                    "description": "ID of a company already existing in lemlist to link to this contact. Takes priority over `companyDomain` and `companyLinkedinUrl`."
                  },
                  "companyDomain": {
                    "type": "string",
                    "description": "Domain of a company already existing in lemlist to link to this contact (e.g. `lemlist.com`). Used if `companyId` is not provided."
                  },
                  "companyLinkedinUrl": {
                    "type": "string",
                    "description": "LinkedIn URL of a company already existing in lemlist to link to this contact. Used if `companyId` and `companyDomain` are not provided."
                  }
                },
                "additionalProperties": {
                  "description": "Any additional key is treated as a custom field. Custom fields must be registered in the team's CRM field registry beforehand."
                }
              },
              "example": {
                "email": "jane.smith@example.com",
                "firstName": "Jane",
                "lastName": "Smith",
                "linkedinUrl": "https://linkedin.com/in/janesmith",
                "jobTitle": "Product Manager",
                "companyDomain": "acme.com"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Contact created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string",
                          "description": "Unique contact identifier"
                        },
                        "teamId": {
                          "type": "string",
                          "description": "Team ID"
                        },
                        "emails": {
                          "type": "array",
                          "description": "Contact email addresses",
                          "items": {
                            "type": "object",
                            "properties": {
                              "value": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "linkedinUrl": {
                          "type": "string",
                          "description": "LinkedIn profile URL"
                        },
                        "linkedinUrlSalesNav": {
                          "type": "string",
                          "description": "LinkedIn Sales Navigator URL"
                        },
                        "fields": {
                          "type": "object",
                          "description": "Key/value fields (firstName, lastName, phone, jobTitle, custom fields, etc.)",
                          "additionalProperties": true
                        },
                        "ownerId": {
                          "type": "string",
                          "description": "Owner user ID"
                        },
                        "companyId": {
                          "type": "string",
                          "description": "Linked company ID (present only when a company was linked)"
                        },
                        "source": {
                          "type": "string",
                          "description": "Record origin"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time",
                          "description": "Creation timestamp"
                        },
                        "createdBy": {
                          "type": "string",
                          "description": "User ID who created the record"
                        },
                        "unsubscribed": {
                          "type": "boolean",
                          "description": "Whether the contact is unsubscribed"
                        },
                        "created": {
                          "type": "boolean",
                          "description": "`true` when a new contact was created, `false` when an existing contact was updated."
                        },
                        "updated": {
                          "type": "boolean",
                          "description": "Present and set to `true` only when an existing contact was updated (i.e. `created` is `false`)."
                        },
                        "companyLinked": {
                          "type": "boolean",
                          "description": "Whether a company was successfully linked to the contact."
                        }
                      }
                    },
                    "warnings": {
                      "type": "array",
                      "description": "Optional warnings (e.g. company resolution issues).",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string"
                          },
                          "message": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "_id": "ctc_xW8Ou6C03Csv8vatp",
                    "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                    "emails": [
                      {
                        "value": "jane.smith@example.com"
                      }
                    ],
                    "linkedinUrl": "https://www.linkedin.com/in/janesmith",
                    "fields": {
                      "firstName": "Jane",
                      "lastName": "Smith",
                      "jobTitle": "Product Manager"
                    },
                    "ownerId": "usr_ahfFktBBHUIxbVG5P",
                    "source": "api",
                    "createdAt": "2025-10-28T00:40:37.917Z",
                    "createdBy": "usr_ahfFktBBHUIxbVG5P",
                    "unsubscribed": false,
                    "created": true,
                    "companyLinked": true,
                    "companyId": "cpn_gG7PsmZFpEAnpMCHO"
                  }
                }
              }
            }
          },
          "200": {
            "description": "Existing contact updated (upsert matched by email or LinkedIn URL)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "description": "Same shape as the 201 response, with `created: false` and `updated: true`."
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "_id": "ctc_xW8Ou6C03Csv8vatp",
                    "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                    "emails": [
                      {
                        "value": "jane.smith@example.com"
                      }
                    ],
                    "fields": {
                      "firstName": "Jane",
                      "lastName": "Smith",
                      "jobTitle": "Product Manager"
                    },
                    "ownerId": "usr_ahfFktBBHUIxbVG5P",
                    "source": "api",
                    "createdAt": "2025-10-28T00:40:37.917Z",
                    "createdBy": "usr_ahfFktBBHUIxbVG5P",
                    "unsubscribed": false,
                    "created": false,
                    "updated": true,
                    "companyLinked": false
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Error code: `MISSING_IDENTIFIER`, `INVALID_CONTACT_ID`, `CONTACT_NOT_FOUND_BY_ID`, `INVALID_EMAIL`, `INVALID_ADDITIONAL_EMAILS`, `INVALID_LINKEDIN_URL`, `INVALID_FIELD`, or `CONTACT_VALIDATION_FAILED`."
                        },
                        "message": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "MISSING_IDENTIFIER",
                    "message": "At least one identifier is required: email, linkedinUrl or contactId"
                  }
                }
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/contacts/{idOrEmail}": {
      "parameters": [
        {
          "name": "idOrEmail",
          "in": "path",
          "required": true,
          "description": "The unique identifier or email of the contact",
          "example": "ctc_XXBXpAxmxwg24IzBI",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "summary": "Get Contact",
        "tags": [
          "Contacts"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                },
                "example": {
                  "_id": "ctc_xW8Ou6C03Csv8vatp",
                  "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                  "fullName": "John Doe",
                  "email": "support@lemlist.com",
                  "fields": {
                    "firstName": "John",
                    "jobTitle": "Growth Engineer",
                    "lastName": "Doe",
                    "industry": "Technology",
                    "isActiveInCampaigns": false,
                    "lastCampaign": "NEW TO DELETE",
                    "lastLeadMarkedAsInterestedDate": "2025-10-28T02:12:31.971Z",
                    "leadStatus": "Marked as not Interested by api"
                  },
                  "campaigns": [
                    {
                      "campaignId": "cam_bSn8EORHQxbWPjHvu",
                      "campaignState": "running",
                      "leadState": "review",
                      "leadId": "lea_fiDpiGV585wy3Oii2"
                    }
                  ],
                  "ownerId": "usr_ahfFktBBHUIxbVG5P",
                  "createdAt": "2025-10-28T00:40:37.917Z",
                  "createdBy": "usr_ahfFktBBHUIxbVG5P",
                  "unsubscribed": false
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        },
        "parameters": []
      }
    },
    "/contacts/lists": {
      "get": {
        "summary": "Get Contact Lists",
        "description": "Retrieves all static and dynamic contact lists for the team. Optionally filter by name.",
        "tags": [
          "Contacts"
        ],
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Filter lists by name (case-insensitive partial match).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "_id": {
                        "type": "string",
                        "description": "Unique list ID (`clt_xxx` format)"
                      },
                      "name": {
                        "type": "string",
                        "description": "Name of the contact list"
                      },
                      "dynamic": {
                        "type": "boolean",
                        "description": "Whether the list is dynamic (auto-populated by filters) or static (manually managed)"
                      }
                    }
                  }
                },
                "example": [
                  {
                    "_id": "clt_abc123def456ghi78",
                    "name": "Nurturing",
                    "dynamic": false
                  },
                  {
                    "_id": "clt_xyz789uvw012rst34",
                    "name": "Enterprise Prospects",
                    "dynamic": true
                  }
                ]
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      },
      "post": {
        "summary": "Create Contact List",
        "description": "Creates a new static contact list. After creating the list, use `POST /contacts/lists/{listId}/entities` to add contacts to it.",
        "tags": [
          "Contacts"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 200,
                    "description": "Name of the contact list to create (max 200 characters)."
                  }
                }
              },
              "example": {
                "name": "Nurturing"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Contact list created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "list": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Unique list ID (`clt_xxx` format)"
                        },
                        "name": {
                          "type": "string",
                          "description": "Name of the created list"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "message": "Contact list created successfully",
                  "list": {
                    "id": "clt_abc123def456ghi78",
                    "name": "Nurturing"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / name is required / name too long",
            "content": {
              "text/plain": {
                "example": "name is required and must be a non-empty string"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/contacts/lists/{listId}/entities": {
      "parameters": [
        {
          "name": "listId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the contact list (`clt_xxx` format). Must be a **static** contact list.",
          "example": "clt_xxxxxxxxxxxxxxxxx",
          "schema": {
            "type": "string",
            "pattern": "^clt_[a-zA-Z0-9]+$"
          }
        }
      ],
      "post": {
        "summary": "Add or Remove Contacts in a List",
        "description": "Adds existing CRM contacts to a static contact list, or removes them when `?action=remove` is set.\n\n- **Add** (default): send a `POST` with a `contactIds` body. Contacts already in the list are silently skipped (no duplicates) and reported in `alreadyInList`.\n- **Remove**: send a `POST` with `?action=remove` and a `contactIds` body. Contacts that are not in the list are silently skipped; `removedCount` reflects the associations actually removed. This only affects list membership, the contacts are not deleted from your CRM.\n\nThe list must be a **static** contact list (`clt_xxx`). Dynamic lists (auto-populated by filter rules) and company lists are rejected.\n\n**Removal uses `POST ?action=remove` on purpose:** a `DELETE` request body is dropped by our stack, so `DELETE` on this path is **not supported** and returns `405 Method Not Allowed`.",
        "tags": [
          "Contacts"
        ],
        "parameters": [
          {
            "name": "action",
            "in": "query",
            "required": false,
            "description": "Omit to **add** the contacts to the list. Set to `remove` to **remove** them from the list.",
            "example": "remove",
            "schema": {
              "type": "string",
              "enum": [
                "remove"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "contactIds"
                ],
                "properties": {
                  "contactIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^ctc_[a-zA-Z0-9]+$"
                    },
                    "minItems": 1,
                    "maxItems": 1000,
                    "description": "Array of contact IDs (`ctc_xxx` format) to add to or remove from the list. Required, non-empty, maximum 1,000 per request."
                  }
                }
              },
              "example": {
                "contactIds": [
                  "ctc_xxxxxxxxxxxxxxxxx",
                  "ctc_yyyyyyyyyyyyyyyyy"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Contacts added to or removed from the list successfully. The response body depends on `action`.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "addedCount": {
                      "type": "integer",
                      "description": "Number of contacts added to the list (add only)."
                    },
                    "alreadyInList": {
                      "type": "integer",
                      "description": "Number of contacts that were already in the list and therefore skipped (add only)."
                    },
                    "removedCount": {
                      "type": "integer",
                      "description": "Number of list associations actually removed (remove only). Contacts that were not in the list are not counted."
                    }
                  }
                },
                "examples": {
                  "add": {
                    "summary": "Add contacts (no action)",
                    "value": {
                      "message": "Contacts added to list successfully",
                      "addedCount": 2,
                      "alreadyInList": 0
                    }
                  },
                  "remove": {
                    "summary": "Remove contacts (action=remove)",
                    "value": {
                      "message": "Contacts removed from list successfully",
                      "removedCount": 2
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / Invalid listId format (expected clt_xxx) / contactIds is required and must be a non-empty array / Maximum 1,000 contacts per request / All contactIds must be in ctc_xxx format / List is not a contact list / Cannot manually add contacts to a dynamic list / Cannot manually remove contacts from a dynamic list.",
            "content": {
              "text/plain": {
                "example": "contactIds is required and must be a non-empty array"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "404": {
            "description": "Contact list not found",
            "content": {
              "text/plain": {
                "example": "Contact list not found"
              }
            }
          },
          "405": {
            "description": "Method not allowed. `DELETE` on this path is not supported because the request body is dropped by our stack. Use `POST ?action=remove` to remove contacts.",
            "content": {
              "text/plain": {
                "example": "Method not allowed"
              }
            }
          },
          "500": {
            "description": "Internal error while updating the list",
            "content": {
              "text/plain": {
                "example": "Failed to add contacts to list"
              }
            }
          }
        }
      }
    },
    "/contacts/export": {
      "get": {
        "summary": "Export Contact List",
        "description": "Exports contacts or companies from a CRM list as a CSV file. The response is streamed as `text/csv` with a `Content-Disposition: attachment` header.\n\nThe exported columns depend on the `entity` type:\n- **contact**: firstName, lastName, email, linkedinUrl, companyName, jobTitle, phone, status, owner, campaigns, contactLists, and more.\n- **company**: name, domain, linkedinUrl, industry, website, status, size, owner, numberOfContacts, companyLists, and more.\n\nCustom fields are included as additional columns.",
        "tags": ["Contacts"],
        "parameters": [
          {
            "name": "listId",
            "in": "query",
            "required": true,
            "description": "The contact list ID to export (`clt_xxx` format), or `\"all\"` to export all contacts.",
            "example": "clt_abc123def456ghi78",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entity",
            "in": "query",
            "required": false,
            "description": "The type of entities to export. Defaults to `\"contact\"`.",
            "schema": {
              "type": "string",
              "enum": ["contact", "company"],
              "default": "contact"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "CSV file download",
            "content": {
              "text/csv": {
                "example": "firstName,lastName,email,companyName,jobTitle,status\nJohn,Doe,john@example.com,Acme Inc,CEO,interested"
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/lemwarm/{userMailboxId}/start": {
      "parameters": [
        {
          "name": "userMailboxId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the user mailbox",
          "example": "usm_2mkqJNUjnJQiyVBht",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "summary": "Start lemwarm",
        "tags": [
          "lemwarm"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / Error from warmupToggle (invalid-usermailbox, invalid-sender, mailbox-deleted, emailWarmedByAnotherAccount, billing-error, etc.)",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/lemwarm/{userMailboxId}/pause": {
      "parameters": [
        {
          "name": "userMailboxId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the user mailbox",
          "example": "usm_2mkqJNUjnJQiyVBht",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "summary": "Pause lemwarm",
        "tags": [
          "lemwarm"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / Error from warmupToggle",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/lemwarm/{userMailboxId}/settings": {
      "parameters": [
        {
          "name": "userMailboxId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the user mailbox",
          "example": "usm_2mkqJNUjnJQiyVBht",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "summary": "Get lemwarm Settings",
        "tags": [
          "lemwarm"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LemwarmSettings"
                },
                "example": {
                  "warmEmailRampup": 5,
                  "warmEmailMax": 5,
                  "activeAt": "2025-04-10T07:38:31.530Z",
                  "deliverability": {
                    "score": 70,
                    "lastAt": "2025-04-09T13:34:43.998Z"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / Error retrieving settings",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      },
      "patch": {
        "summary": "Update lemwarm Settings",
        "tags": [
          "lemwarm"
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "warmEmailMax": {
                    "type": "integer",
                    "description": "Maximum number of warm emails per day"
                  },
                  "warmEmailRampup": {
                    "type": "integer",
                    "description": "Daily increase in warm email count"
                  }
                }
              },
              "example": {
                "warmEmailMax": 30,
                "warmEmailRampup": 5
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / Error updating settings (warmEmailMax, warmEmailRampup)",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/companies": {
      "get": {
        "summary": "Get Many Companies",
        "tags": [
          "Companies"
        ],
        "parameters": [
          {
            "name": "idsOrDomains",
            "in": "query",
            "required": false,
            "description": "Comma-separated list of company IDs or domains to fetch. When provided, returns only matching companies (no pagination). Each value is classified as a company ID (e.g. `cpn_xxx`) or a domain (e.g. `example.com`). URLs are normalized automatically (e.g. `https://example.com/path` → `example.com`). Invalid values are silently skipped. Maximum 100 values.",
            "example": "cpn_gG7PsmZFpEAnpMCHO,persana.ai",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Number of companies to skip for pagination. Defaults to 0. Ignored when `idsOrDomains` is provided.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "required": false,
            "description": "The field by which to sort. Currently, only 'createdAt' is supported.",
            "example": "createdAt",
            "schema": {
              "type": "string",
              "enum": [
                "createdAt"
              ]
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "required": false,
            "description": "The sort direction. Use 'desc' for descending order; any other value (or omission) will sort in ascending order.",
            "example": "desc",
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Search by company name (case insensitive)",
            "example": "lemlist",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fields",
            "in": "query",
            "required": false,
            "description": "Returns selected fields. Returns all fields if empty. Each field is separated by a comma (e.g., '_id,fields.name,domain')",
            "example": "_id,fields.name,domain",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Number of companies to retrieve. Default: 100. Maximum: 500",
            "example": "10",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            }
          },
          {
            "name": "crmSyncStatus",
            "in": "query",
            "required": false,
            "description": "Filter companies by their CRM sync state against the team's active CRM provider. Requires a CRM (Hubspot, Salesforce, or Pipedrive) to be connected — otherwise the request returns `400 NO_CRM_CONNECTED`. Common values:\n- `synced` — the company has a CRM record and no sync errors.\n- `not_synced` — the company has no CRM record yet.\n- `error` — at least one sync error is currently raised.\n- A specific error reason (lowercase form), to filter by root cause: `unique_index_error_company`, `property_doesnt_exist`, `required_field_missing`, `company_already_exists_with_name`, `company_already_exists_with_linkedin_url`.\n\nFor each returned company, see `crmSync.errors[].metadata.alreadyExistingCompanyId` to identify the lemlist company that already occupies the conflicting CRM record (useful to remap contacts before deleting the duplicate).",
            "example": "unique_index_error_company",
            "schema": {
              "type": "string",
              "enum": [
                "synced",
                "not_synced",
                "error",
                "unique_index_error_company",
                "property_doesnt_exist",
                "required_field_missing",
                "company_already_exists_with_name",
                "company_already_exists_with_linkedin_url"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Company"
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "data",
                    "total",
                    "limit",
                    "offset"
                  ]
                },
                "example": {
                  "data": [
                    {
                      "_id": "cpn_gG7PsmZFpEAnpMCHO",
                      "createdAt": "2025-10-26T11:54:27.387Z",
                      "createdBy": "usr_iGBmhLaxZmL0s7k1G",
                      "domain": "persana.ai",
                      "fields": {
                        "name": "Persana AI",
                        "picture": "https://example.com/logos/company-1.png"
                      },
                      "ownerId": "usr_iGBmhLaxZmL0s7k1G"
                    },
                    {
                      "_id": "cpn_FEWCjzMWXo5StjpDa",
                      "createdAt": "2025-10-26T11:45:18.773Z",
                      "createdBy": "usr_iGBmhLaxZmL0s7k1G",
                      "domain": "duno.ai",
                      "fields": {
                        "industry": "IT Services and IT Consulting",
                        "name": "Duno.ai",
                        "picture": "https://example.com/logos/company-2.png"
                      },
                      "ownerId": "usr_iGBmhLaxZmL0s7k1G"
                    },
                    {
                      "_id": "cpn_2STz8x5Bexmd0nvIz",
                      "createdAt": "2025-10-25T21:37:45.741Z",
                      "createdBy": "usr_iGBmhLaxZmL0s7k1G",
                      "domain": "tally.so",
                      "fields": {
                        "industry": "Computer Software",
                        "name": "lemlist family",
                        "picture": "https://example.com/logos/lemlist.png"
                      },
                      "ownerId": "usr_iGBmhLaxZmL0s7k1G"
                    },
                    {
                      "_id": "cpn_Qf4CJuUrNUNmHm6uZ",
                      "createdAt": "2025-10-24T07:26:34.956Z",
                      "createdBy": "usr_ahfFktBBHUIxbVG5P",
                      "domain": "example.com",
                      "fields": {
                        "name": "Growth & GTM Engineering"
                      },
                      "ownerId": "usr_ahfFktBBHUIxbVG5P"
                    },
                    {
                      "_id": "cpn_A1B2C3D4E5F6G7H8I",
                      "createdAt": "2025-11-02T09:14:08.512Z",
                      "createdBy": "usr_A1B2C3D4E5F6G7H8I",
                      "domain": "acme.com",
                      "fields": {
                        "name": "Acme Inc"
                      },
                      "ownerId": "usr_A1B2C3D4E5F6G7H8I",
                      "crmSync": {
                        "provider": "hubspot",
                        "crmRecordId": null,
                        "syncDisabled": false,
                        "errors": [
                          {
                            "type": "CONNECT_FAILED",
                            "reason": "UNIQUE_INDEX_ERROR_COMPANY",
                            "raisedAt": "2025-11-02T09:14:12.034Z",
                            "metadata": {
                              "alreadyExistingCompanyId": "cpn_J1K2L3M4N5O6P7Q8R"
                            }
                          }
                        ]
                      }
                    }
                  ],
                  "total": 59310,
                  "limit": 100,
                  "offset": 0
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      },
      "post": {
        "summary": "Add and update company",
        "description": "Creates a new company or updates an existing one (upsert). If a company with the same domain, LinkedIn URL, or Sales Navigator URL already exists, it will be updated with the provided non-empty fields. Null or empty values are ignored during updates to preserve existing data. You can target an existing company directly by providing `companyId`, bypassing domain/LinkedIn matching — in that case `name` and `domain` become optional.",
        "tags": [
          "Companies"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "companyId": {
                    "type": "string",
                    "description": "Existing company ID. Updates a specific company by ID, bypassing domain/LinkedIn matching. Can only be used to update an existing company, not to create a new one. When provided, `name` and `domain` become optional."
                  },
                  "name": {
                    "type": "string",
                    "description": "Company name. Required unless `companyId` is provided."
                  },
                  "domain": {
                    "type": "string",
                    "description": "Company website domain (e.g. `lemlist.com`). Used as a unique key for upsert matching. Required unless `companyId` is provided."
                  },
                  "linkedinUrl": {
                    "type": "string",
                    "description": "LinkedIn company page URL. Used as an alternative unique key for upsert matching."
                  },
                  "linkedinUrlSalesNav": {
                    "type": "string",
                    "description": "LinkedIn Sales Navigator company URL. Used as an alternative unique key for upsert matching."
                  },
                  "companyOwner": {
                    "type": "string",
                    "description": "Owner of the company. Can be a user ID (e.g. `usr_...`) or a team member's email address. If the provided value does not match a team member, the owner defaults to the API key owner."
                  },
                  "industry": {
                    "type": "string",
                    "description": "Industry sector of the company."
                  },
                  "location": {
                    "type": "string",
                    "description": "Geographic location of the company."
                  },
                  "size": {
                    "type": "string",
                    "description": "Company size."
                  },
                  "specialties": {
                    "type": "string",
                    "description": "Company specialties."
                  },
                  "tagline": {
                    "type": "string",
                    "description": "Company tagline."
                  },
                  "type": {
                    "type": "string",
                    "description": "Company type."
                  },
                  "description": {
                    "type": "string",
                    "description": "Company description."
                  },
                  "foundedOn": {
                    "type": "string",
                    "description": "Company founding date."
                  },
                  "headquarters": {
                    "type": "string",
                    "description": "Company headquarters location."
                  },
                  "picture": {
                    "type": "string",
                    "description": "URL of the company logo or picture."
                  },
                  "source": {
                    "type": "string",
                    "description": "Origin of the company record. Set on creation only and cannot be updated afterwards. Defaults to `api`.",
                    "default": "api"
                  }
                },
                "additionalProperties": {
                  "description": "Any additional key is treated as a custom field. Custom fields must be registered in the team's CRM field registry beforehand."
                }
              },
              "example": {
                "name": "Acme Corp",
                "domain": "acme.com",
                "linkedinUrl": "https://linkedin.com/company/acme",
                "industry": "Technology",
                "location": "San Francisco, CA"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Company created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "_id": {
                          "type": "string",
                          "description": "Unique company identifier"
                        },
                        "teamId": {
                          "type": "string",
                          "description": "Team ID"
                        },
                        "domain": {
                          "type": "string",
                          "description": "Company domain"
                        },
                        "linkedinUrl": {
                          "type": "string",
                          "description": "LinkedIn URL"
                        },
                        "fields": {
                          "type": "object",
                          "description": "Key/value fields (name, picture, industry, location, custom fields, etc.)",
                          "additionalProperties": true
                        },
                        "ownerId": {
                          "type": "string",
                          "description": "Owner user ID"
                        },
                        "source": {
                          "type": "string",
                          "description": "Record origin"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time",
                          "description": "Creation timestamp"
                        },
                        "createdBy": {
                          "type": "string",
                          "description": "User ID who created the record"
                        },
                        "created": {
                          "type": "boolean",
                          "description": "`true` when a new company was created, `false` when an existing company was updated."
                        },
                        "updated": {
                          "type": "boolean",
                          "description": "Present and set to `true` only when an existing company was updated (i.e. `created` is `false`)."
                        }
                      }
                    },
                    "warnings": {
                      "type": "array",
                      "description": "Optional warnings (e.g. owner resolution issues).",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string"
                          },
                          "message": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "_id": "cpn_gG7PsmZFpEAnpMCHO",
                    "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                    "domain": "acme.com",
                    "linkedinUrl": "https://www.linkedin.com/company/acme",
                    "fields": {
                      "name": "Acme Corp",
                      "industry": "Technology",
                      "location": "San Francisco, CA"
                    },
                    "ownerId": "usr_ahfFktBBHUIxbVG5P",
                    "source": "api",
                    "createdAt": "2025-10-28T00:40:37.917Z",
                    "createdBy": "usr_ahfFktBBHUIxbVG5P",
                    "created": true
                  }
                }
              }
            }
          },
          "200": {
            "description": "Existing company updated (upsert matched by domain or LinkedIn URL)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "description": "Same shape as the 201 response, with `created: false` and `updated: true`."
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "_id": "cpn_gG7PsmZFpEAnpMCHO",
                    "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                    "domain": "acme.com",
                    "fields": {
                      "name": "Acme Corp",
                      "industry": "Technology",
                      "location": "San Francisco, CA"
                    },
                    "ownerId": "usr_ahfFktBBHUIxbVG5P",
                    "source": "api",
                    "createdAt": "2025-10-28T00:40:37.917Z",
                    "createdBy": "usr_ahfFktBBHUIxbVG5P",
                    "created": false,
                    "updated": true
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "description": "Error code: `MISSING_REQUIRED_FIELD`, `INVALID_COMPANY_ID`, `COMPANY_NOT_FOUND_BY_ID`, `INVALID_DOMAIN`, `INVALID_LINKEDIN_URL`, or `INVALID_FIELD`."
                        },
                        "message": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "MISSING_REQUIRED_FIELD",
                    "message": "Missing required field: name"
                  }
                }
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/companies/{companyId}": {
      "delete": {
        "summary": "Delete Company",
        "description": "Deletes a lemlist company. Refuses by default when contacts are still attached — pass `force=true` to detach them (the `companyId` field is unset on each contact) before deleting the company.\n\n**No CRM-side propagation:** only the lemlist record is removed. Designed for the contact-to-company remapping workflow: after reassigning the contacts of a duplicate company to the canonical one (via `POST /contacts/{idOrEmail}`), call this endpoint to drop the now-empty duplicate.",
        "tags": [
          "Companies"
        ],
        "parameters": [
          {
            "name": "companyId",
            "in": "path",
            "required": true,
            "description": "The lemlist company ID to delete.",
            "example": "cpn_A1B2C3D4E5F6G7H8I",
            "schema": {
              "type": "string",
              "pattern": "^cpn_[a-zA-Z0-9]+$"
            }
          },
          {
            "name": "force",
            "in": "query",
            "required": false,
            "description": "When `true`, detaches contacts attached to this company (unsets their `companyId`) before deleting it. When omitted or `false`, the request fails with `400 COMPANY_HAS_CONTACTS` if any contact is still attached.",
            "example": "true",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Company deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "deletedCompanyId": {
                      "type": "string",
                      "description": "ID of the deleted lemlist company."
                    },
                    "unlinkedContacts": {
                      "type": "integer",
                      "description": "Number of contacts whose `companyId` was unset before deletion. Only present when `force=true`."
                    }
                  },
                  "required": [
                    "success",
                    "deletedCompanyId"
                  ]
                },
                "examples": {
                  "no contacts attached": {
                    "value": {
                      "success": true,
                      "deletedCompanyId": "cpn_A1B2C3D4E5F6G7H8I"
                    }
                  },
                  "force=true with attached contacts": {
                    "value": {
                      "success": true,
                      "deletedCompanyId": "cpn_A1B2C3D4E5F6G7H8I",
                      "unlinkedContacts": 3
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request. Possible error codes: `INVALID_COMPANY_ID` (malformed ID), `COMPANY_HAS_CONTACTS` (contacts still attached and `force` not set).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "contactCount": {
                          "type": "integer",
                          "description": "Only on `COMPANY_HAS_CONTACTS` — how many contacts are still attached."
                        }
                      }
                    }
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "COMPANY_HAS_CONTACTS",
                    "message": "Company still has contacts attached. Pass ?force=true to detach them before deletion. (3 contacts attached)",
                    "contactCount": 3
                  }
                }
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect.",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "404": {
            "description": "Company not found (`COMPANY_NOT_FOUND_BY_ID`).",
            "content": {
              "application/json": {
                "example": {
                  "success": false,
                  "error": {
                    "code": "COMPANY_NOT_FOUND_BY_ID",
                    "message": "Company not found by ID"
                  }
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed."
          }
        }
      }
    },
    "/companies/{companyId}/notes": {
      "parameters": [
        {
          "name": "companyId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the company",
          "example": "cmp_ABC123",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "summary": "Get Company Notes",
        "tags": [
          "Companies"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Number of notes to retrieve. Default: 100. Maximum: 100",
            "example": "2",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number to retrieve",
            "example": "1",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "required": false,
            "description": "The field by which to sort. Currently, only 'createdAt' is supported.",
            "example": "createdAt",
            "schema": {
              "type": "string",
              "enum": [
                "createdAt"
              ]
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "required": false,
            "description": "The sort direction. Use 'desc' for descending order; any other value (or omission) will sort in ascending order.",
            "example": "desc",
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CompanyNote"
                      }
                    },
                    "total": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "data",
                    "total"
                  ]
                },
                "example": {
                  "data": [
                    {
                      "_id": "act_j0NrG6rYEPP9TMmWC",
                      "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                      "companyId": "cpn_Qf4CJuUrNUNmHm6uZ",
                      "createdAt": "2025-10-28T04:25:00.653Z",
                      "note": "could help our GTM team be more productive",
                      "userId": "usr_ahfFktBBHUIxbVG5P"
                    },
                    {
                      "_id": "act_BYF2j06u0wgeLncub",
                      "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                      "companyId": "cpn_Qf4CJuUrNUNmHm6uZ",
                      "createdAt": "2025-10-24T12:42:40.605Z",
                      "note": "Note created from the API!",
                      "userId": "usr_ahfFktBBHUIxbVG5P"
                    }
                  ],
                  "total": 2
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "404": {
            "description": "Company not found",
            "content": {
              "text/plain": {
                "example": "Company not found"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      },
      "post": {
        "summary": "Create Company Note",
        "tags": [
          "Companies"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "description": "The note content"
                  }
                },
                "required": [
                  "note"
                ]
              },
              "example": {
                "note": "Note created from the API!"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyNote"
                },
                "example": {
                  "_id": "act_j0NrG6rYEPP9TMmWC",
                  "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                  "companyId": "cpn_Qf4CJuUrNUNmHm6uZ",
                  "type": "annotated",
                  "createdAt": "2025-10-28T04:25:00.653Z",
                  "note": "could help our GTM team be more productive",
                  "sendUserId": "usr_ahfFktBBHUIxbVG5P",
                  "userId": "usr_ahfFktBBHUIxbVG5P"
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "404": {
            "description": "Company not found",
            "content": {
              "text/plain": {
                "example": "Company not found"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        },
        "parameters": []
      }
    },
    "/activities": {
      "get": {
        "summary": "Get Many Activities",
        "tags": [
          "Activities"
        ],
        "parameters": [
          {
            "name": "version",
            "in": "query",
            "required": true,
            "description": "API version. v2 is mandatory",
            "example": "v2",
            "schema": {
              "type": "string",
              "enum": [
                "v2"
              ]
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "Filter by activity type (e.g., paused)",
            "example": "paused",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "campaignId",
            "in": "query",
            "required": false,
            "description": "Filter by campaign ID",
            "example": "cam_123",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "isFirst",
            "in": "query",
            "required": false,
            "description": "Filter for first activity",
            "example": "true",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Number of records to skip. Note: This is not traditional cursor-based pagination. To retrieve all activities, increment offset by the limit value on each request (e.g., offset=0, then offset=100, then offset=200, etc.).",
            "example": "0",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Number of activities to retrieve. Default: 100. Maximum: 100",
            "example": "2",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "leadId",
            "in": "query",
            "required": false,
            "description": "Filter by lead ID",
            "example": "lea_123",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "minDate",
            "in": "query",
            "required": false,
            "description": "Filter activities by `createdAt >= minDate`. Accepts either a Unix timestamp in seconds (e.g. `1715385600`) or an ISO 8601 datetime (e.g. `2026-05-11T00:00:00Z`). `minDate` is the primary name; `startDate` is accepted as an alias and `minDate` takes precedence when both are provided.",
            "example": "2026-05-01T00:00:00Z",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "maxDate",
            "in": "query",
            "required": false,
            "description": "Filter activities by `createdAt <= maxDate`. Accepts either a Unix timestamp in seconds (e.g. `1715385600`) or an ISO 8601 datetime (e.g. `2026-05-11T00:00:00Z`). Must be strictly greater than `minDate` when both are provided. `maxDate` is the primary name; `endDate` is accepted as an alias and `maxDate` takes precedence when both are provided.",
            "example": "2026-05-31T23:59:59Z",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "required": false,
            "description": "Alias for `minDate`, provided for consistency with sibling endpoints (e.g. `/campaigns/{campaignId}/stats`). Accepts either a Unix timestamp in seconds or an ISO 8601 datetime. Ignored when `minDate` is also provided.",
            "example": "2026-05-01T00:00:00Z",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "required": false,
            "description": "Alias for `maxDate`, provided for consistency with sibling endpoints (e.g. `/campaigns/{campaignId}/stats`). Accepts either a Unix timestamp in seconds or an ISO 8601 datetime. Ignored when `maxDate` is also provided.",
            "example": "2026-05-31T23:59:59Z",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Activity"
                  }
                },
                "example": [
                  {
                    "_id": "act_PbKqTGpQqSlPcoOZ5",
                    "type": "manualDone",
                    "userId": "usr_Emu1g29BMtBixhMSP",
                    "userName": "Guillaume Moubeche",
                    "bot": false,
                    "createdAt": "2025-10-28T08:07:38.375Z",
                    "leadFirstName": "John",
                    "leadLastName": "Doe",
                    "leadEmail": "support@lemlist.com",
                    "leadCompanyName": "Acme Inc",
                    "leadId": "lea_fiDpiGV585wy3Oii2",
                    "contactId": "ctc_xW8Ou6C03Csv8vatp",
                    "campaignId": "cam_bSn8EORHQxbWPjHvu",
                    "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                    "opportunityId": "opp_LyXDV8KHzctQdLFpG",
                    "metaData": {
                      "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                      "campaignId": "cam_bSn8EORHQxbWPjHvu",
                      "leadId": "lea_fiDpiGV585wy3Oii2",
                      "type": "manualDone"
                    },
                    "lead": {
                      "_id": "lea_fiDpiGV585wy3Oii2",
                      "isPaused": false,
                      "state": "manualNotInterested",
                      "personalized": false,
                      "source": "api",
                      "variables": {
                        "firstName": "John",
                        "lastName": "Doe",
                        "companyName": "Acme Inc",
                        "jobTitle": "Growth Engineer",
                        "companyDomain": "example.com",
                        "email": "support@lemlist.com",
                        "preferredContactMethod": "email",
                        "industry": "Technology",
                        "Company name": "John Doe"
                      },
                      "contactId": "ctc_xW8Ou6C03Csv8vatp",
                      "enrichment": {
                        "emailStatus": "deliverable"
                      }
                    },
                    "campaignName": "NEW TO DELETE",
                    "sequenceTested": "B"
                  },
                  {
                    "_id": "act_j0NrG6rYEPP9TMmWC",
                    "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                    "companyId": "cpn_Qf4CJuUrNUNmHm6uZ",
                    "type": "annotated",
                    "createdAt": "2025-10-28T04:25:00.653Z",
                    "note": "could help our GTM team be more productive",
                    "sendUserId": "usr_ahfFktBBHUIxbVG5P",
                    "userId": "usr_ahfFktBBHUIxbVG5P"
                  },
                  {
                    "_id": "act_WeKrlIaQlBnM3LZ6G",
                    "type": "manualNotInterested",
                    "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                    "userName": "api",
                    "isFirst": false,
                    "bot": false,
                    "createdAt": "2025-10-28T02:14:34.834Z",
                    "name": "NEW TO DELETE",
                    "leadFirstName": "John",
                    "leadLastName": "Doe",
                    "leadEmail": "support@lemlist.com",
                    "leadCompanyName": "Acme Inc",
                    "leadId": "lea_fiDpiGV585wy3Oii2",
                    "contactId": "ctc_xW8Ou6C03Csv8vatp",
                    "campaignId": "cam_bSn8EORHQxbWPjHvu",
                    "metaData": {
                      "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                      "campaignId": "cam_bSn8EORHQxbWPjHvu",
                      "leadId": "lea_fiDpiGV585wy3Oii2",
                      "type": "manualNotInterested"
                    },
                    "lead": {
                      "_id": "lea_fiDpiGV585wy3Oii2",
                      "isPaused": false,
                      "state": "manualNotInterested",
                      "personalized": false,
                      "source": "api",
                      "variables": {
                        "firstName": "John",
                        "lastName": "Doe",
                        "companyName": "Acme Inc",
                        "jobTitle": "Growth Engineer",
                        "companyDomain": "example.com",
                        "email": "support@lemlist.com",
                        "preferredContactMethod": "email",
                        "industry": "Technology",
                        "Company name": "John Doe"
                      },
                      "contactId": "ctc_xW8Ou6C03Csv8vatp",
                      "enrichment": {
                        "emailStatus": "deliverable"
                      }
                    },
                    "campaignName": "NEW TO DELETE",
                    "sequenceTested": "B"
                  },
                  {
                    "_id": "act_zktTG4HXXXSOQya5U",
                    "type": "paused",
                    "userName": "api",
                    "bot": false,
                    "createdAt": "2025-10-28T01:54:56.099Z",
                    "name": "NEW TO DELETE",
                    "leadFirstName": "John",
                    "leadLastName": "Doe",
                    "leadEmail": "support@lemlist.com",
                    "leadCompanyName": "Acme Inc",
                    "leadId": "lea_fiDpiGV585wy3Oii2",
                    "contactId": "ctc_xW8Ou6C03Csv8vatp",
                    "campaignId": "cam_bSn8EORHQxbWPjHvu",
                    "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                    "metaData": {
                      "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                      "campaignId": "cam_bSn8EORHQxbWPjHvu",
                      "leadId": "lea_fiDpiGV585wy3Oii2",
                      "type": "paused"
                    },
                    "lead": {
                      "_id": "lea_fiDpiGV585wy3Oii2",
                      "isPaused": false,
                      "state": "manualNotInterested",
                      "personalized": false,
                      "source": "api",
                      "variables": {
                        "firstName": "John",
                        "lastName": "Doe",
                        "companyName": "Acme Inc",
                        "jobTitle": "Growth Engineer",
                        "companyDomain": "example.com",
                        "email": "support@lemlist.com",
                        "preferredContactMethod": "email",
                        "industry": "Technology",
                        "Company name": "John Doe"
                      },
                      "contactId": "ctc_xW8Ou6C03Csv8vatp",
                      "enrichment": {
                        "emailStatus": "deliverable"
                      }
                    },
                    "campaignName": "NEW TO DELETE",
                    "sequenceTested": "B"
                  },
                  {
                    "_id": "act_x6esGLhoPa2SMHCZ7",
                    "type": "emailsOpened",
                    "isFirst": false,
                    "stopped": false,
                    "createdAt": "2025-10-27T20:20:59.696Z",
                    "bot": false,
                    "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                    "leadId": "lea_wj47uWhDbbN6Qq6oT",
                    "campaignId": "cam_oxeGg6paG3ZVxjHkH",
                    "sequenceId": "seq_ODjsLXkxXiySRw6dK",
                    "sequenceStep": 1,
                    "emailTemplateId": "etp_z3nAbjdHuewVEjIl5",
                    "createdBy": "usr_EvXz6JqPSJJL9lHkp",
                    "sendUserId": "usr_EvXz6JqPSJJL9lHkp",
                    "name": "Unicorn campaign",
                    "leadFirstName": "Sam",
                    "leadLastName": "Taylor",
                    "leadEmail": "sam@example.com",
                    "leadCompanyName": "lemlist",
                    "contactId": "ctc_FkeUdQHEfhqG2HMbK",
                    "relatedSentAt": "2020-12-07T11:49:14.830Z",
                    "metaData": {
                      "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                      "campaignId": "cam_oxeGg6paG3ZVxjHkH",
                      "leadId": "lea_wj47uWhDbbN6Qq6oT",
                      "type": "emailsOpened",
                      "createdBy": "usr_EvXz6JqPSJJL9lHkp",
                      "taskId": "tsk_namMcIQnA6gxQIupP"
                    },
                    "lead": {
                      "_id": "lea_wj47uWhDbbN6Qq6oT",
                      "isPaused": false,
                      "state": "emailsUnsubscribed",
                      "personalized": false,
                      "source": "manually",
                      "variables": {
                        "firstName": "Sam ",
                        "lastName": "Taylor",
                        "email": "sam@example.com",
                        "companyName": "lemlist",
                        "linkedinUrl": "https://www.linkedin.com/in/sam-doe"
                      },
                      "contactId": "ctc_FkeUdQHEfhqG2HMbK",
                      "enrichment": {}
                    },
                    "campaignName": "Unicorn campaign",
                    "sequenceTested": "A",
                    "emailTemplateName": "Blank"
                  },
                  {
                    "_id": "act_q4tnlXNdXsBeQceYW",
                    "type": "emailsOpened",
                    "isFirst": false,
                    "stopped": false,
                    "createdAt": "2025-10-27T20:17:24.119Z",
                    "bot": false,
                    "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                    "leadId": "lea_wj47uWhDbbN6Qq6oT",
                    "campaignId": "cam_oxeGg6paG3ZVxjHkH",
                    "sequenceId": "seq_ODjsLXkxXiySRw6dK",
                    "sequenceStep": 1,
                    "emailTemplateId": "etp_z3nAbjdHuewVEjIl5",
                    "createdBy": "usr_EvXz6JqPSJJL9lHkp",
                    "sendUserId": "usr_EvXz6JqPSJJL9lHkp",
                    "name": "Unicorn campaign",
                    "leadFirstName": "Sam",
                    "leadLastName": "Taylor",
                    "leadEmail": "sam@example.com",
                    "leadCompanyName": "lemlist",
                    "contactId": "ctc_FkeUdQHEfhqG2HMbK",
                    "relatedSentAt": "2020-12-07T11:49:14.830Z",
                    "metaData": {
                      "teamId": "tea_8QvkOiBfPdb2ZRhHi",
                      "campaignId": "cam_oxeGg6paG3ZVxjHkH",
                      "leadId": "lea_wj47uWhDbbN6Qq6oT",
                      "type": "emailsOpened",
                      "createdBy": "usr_EvXz6JqPSJJL9lHkp",
                      "taskId": "tsk_namMcIQnA6gxQIupP"
                    },
                    "lead": {
                      "_id": "lea_wj47uWhDbbN6Qq6oT",
                      "isPaused": false,
                      "state": "emailsUnsubscribed",
                      "personalized": false,
                      "source": "manually",
                      "variables": {
                        "firstName": "Sam ",
                        "lastName": "Taylor",
                        "email": "sam@example.com",
                        "companyName": "lemlist",
                        "linkedinUrl": "https://www.linkedin.com/in/sam-doe"
                      },
                      "contactId": "ctc_FkeUdQHEfhqG2HMbK",
                      "enrichment": {}
                    },
                    "campaignName": "Unicorn campaign",
                    "sequenceTested": "A",
                    "emailTemplateName": "Blank"
                  }
                ]
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/activities/{activityId}/recording-transcript": {
      "delete": {
        "summary": "Delete Activity Recording & Transcript",
        "tags": [
          "Activities"
        ],
        "parameters": [
          {
            "name": "activityId",
            "in": "path",
            "required": true,
            "description": "Unique activity ID",
            "example": "act_123",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "example": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Activity not found or has no recording",
            "content": {
              "text/plain": {
                "example": "Activity not found"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          },
          "500": {
            "description": "Error while deleting recording or transcript"
          }
        }
      }
    },
    "/v2/campaigns/{campaignId}/stats": {
      "get": {
        "summary": "Get Campaign Stats",
        "tags": [
          "Campaigns"
        ],
        "description": "Retrieve detailed statistics for a specific campaign, with filtering options by date, user, A/B testing, and communication channels.",
        "parameters": [
          {
            "name": "campaignId",
            "in": "path",
            "required": true,
            "description": "Unique campaign ID",
            "example": "cam_123",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "required": true,
            "description": "Start date in ISO 8601 format",
            "example": "2024-01-07T22:00:00.000Z",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "required": true,
            "description": "End date in ISO 8601 format",
            "example": "2025-07-10T21:59:59.999Z",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "sendUser",
            "in": "query",
            "required": false,
            "description": "Filter stats by send user. Format: `sendUserId|sendUserEmail`. The sendUserId should begin with 'usr_' and the sendUserEmail should be a valid sender email. If the param is specified, both sendUserId and sendUserEmail are mandatory.",
            "example": "usr_OcIHizJyIeaDxicQP|email@example.com",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ABSelected",
            "in": "query",
            "required": false,
            "description": "A/B version filter",
            "example": "A",
            "schema": {
              "type": "string",
              "enum": [
                "A",
                "B"
              ]
            }
          },
          {
            "name": "channels",
            "in": "query",
            "required": false,
            "description": "JSON array of channels to include. Possible values: 'email', 'linkedin', 'others'",
            "example": "[\"others\", \"linkedin\", \"email\"]",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "nbLeads": {
                      "type": "integer",
                      "description": "Total number of leads in the campaign"
                    },
                    "nbLeadsLaunched": {
                      "type": "integer",
                      "description": "Number of leads launched in the campaign"
                    },
                    "nbLeadsReached": {
                      "type": "integer",
                      "description": "Number of leads that were successfully reached"
                    },
                    "nbLeadsOpened": {
                      "type": "integer",
                      "description": "Number of leads that opened messages"
                    },
                    "nbLeadsInteracted": {
                      "type": "integer",
                      "description": "Number of leads that interacted with messages (clicked, replied)"
                    },
                    "nbLeadsAnswered": {
                      "type": "integer",
                      "description": "Number of leads that answered"
                    },
                    "nbLeadsInterested": {
                      "type": "integer",
                      "description": "Number of leads marked as interested"
                    },
                    "nbLeadsNotInterested": {
                      "type": "integer",
                      "description": "Number of leads marked as not interested"
                    },
                    "nbLeadsUnsubscribed": {
                      "type": "integer",
                      "description": "Number of leads that unsubscribed"
                    },
                    "nbLeadsInterrupted": {
                      "type": "integer",
                      "description": "Number of leads with interrupted sequences"
                    },
                    "messagesSent": {
                      "type": "integer",
                      "description": "Total number of messages sent"
                    },
                    "messagesNotSent": {
                      "type": "integer",
                      "description": "Number of messages that failed to send"
                    },
                    "messagesBounced": {
                      "type": "integer",
                      "description": "Number of messages that bounced"
                    },
                    "delivered": {
                      "type": "integer",
                      "description": "Number of messages successfully delivered"
                    },
                    "opened": {
                      "type": "integer",
                      "description": "Number of messages opened"
                    },
                    "clicked": {
                      "type": "integer",
                      "description": "Number of messages with clicks"
                    },
                    "replied": {
                      "type": "integer",
                      "description": "Number of messages that received replies"
                    },
                    "invitationAccepted": {
                      "type": "integer",
                      "description": "Number of LinkedIn invitations accepted"
                    },
                    "meetingBooked": {
                      "type": "integer",
                      "description": "Number of meetings booked"
                    },
                    "steps": {
                      "type": "array",
                      "description": "Detailed metrics for each step in the campaign",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer",
                            "description": "Step index in the sequence"
                          },
                          "sequenceId": {
                            "type": "string",
                            "description": "ID of the sequence"
                          },
                          "sequenceStep": {
                            "type": "integer",
                            "description": "Step number within the sequence"
                          },
                          "abTest": {
                            "type": "string",
                            "description": "A/B test variant (if applicable)"
                          },
                          "taskType": {
                            "type": "string",
                            "description": "Type of task",
                            "enum": [
                              "email",
                              "linkedinVisit",
                              "linkedinInvite",
                              "linkedinSend",
                              "phone",
                              "manual",
                              "conditional"
                            ]
                          },
                          "conditionLabel": {
                            "type": "string",
                            "description": "Label for conditional steps"
                          },
                          "invited": {
                            "type": "integer",
                            "description": "Number of LinkedIn invitations sent"
                          },
                          "sent": {
                            "type": "integer",
                            "description": "Number of messages sent"
                          },
                          "delivered": {
                            "type": "integer",
                            "description": "Number of messages delivered"
                          },
                          "opened": {
                            "type": "integer",
                            "description": "Number of messages opened"
                          },
                          "clicked": {
                            "type": "integer",
                            "description": "Number of clicks from a message from this step"
                          },
                          "replied": {
                            "type": "integer",
                            "description": "Number of replies"
                          },
                          "notDelivered": {
                            "type": "integer",
                            "description": "Number of messages not delivered"
                          },
                          "bounced": {
                            "type": "integer",
                            "description": "Number of messages bounced"
                          },
                          "unsubscribed": {
                            "type": "integer",
                            "description": "Number of unsubscribes from this step"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "nbLeads": 32,
                  "nbLeadsLaunched": 32,
                  "nbLeadsReached": 32,
                  "nbLeadsOpened": 31,
                  "nbLeadsInteracted": 4,
                  "nbLeadsAnswered": 16,
                  "nbLeadsInterested": 1,
                  "nbLeadsNotInterested": 0,
                  "nbLeadsUnsubscribed": 1,
                  "nbLeadsInterrupted": 1,
                  "messagesSent": 72,
                  "messagesNotSent": 0,
                  "messagesBounced": 0,
                  "delivered": 72,
                  "opened": 47,
                  "clicked": 4,
                  "replied": 16,
                  "invitationAccepted": 0,
                  "meetingBooked": 0,
                  "steps": [
                    {
                      "index": 1,
                      "sequenceId": "seq_rH5RD3fMkkt2gM3YC",
                      "sequenceStep": 0,
                      "taskType": "linkedinSend",
                      "invited": 0,
                      "sent": 32,
                      "delivered": 32,
                      "opened": 15,
                      "clicked": 0,
                      "replied": 15,
                      "notDelivered": 0,
                      "bounced": 0,
                      "unsubscribed": 1
                    },
                    {
                      "index": 2,
                      "sequenceId": "seq_rH5RD3fMkkt2gM3YC",
                      "sequenceStep": 1,
                      "invited": 0,
                      "sent": 20,
                      "delivered": 20,
                      "opened": 17,
                      "clicked": 1,
                      "replied": 1,
                      "notDelivered": 0,
                      "bounced": 0,
                      "unsubscribed": 0
                    },
                    {
                      "index": 3,
                      "sequenceId": "seq_rH5RD3fMkkt2gM3YC",
                      "sequenceStep": 2,
                      "invited": 0,
                      "sent": 20,
                      "delivered": 20,
                      "opened": 15,
                      "clicked": 3,
                      "replied": 0,
                      "notDelivered": 0,
                      "bounced": 0,
                      "unsubscribed": 0
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request - Invalid parameters",
            "content": {
              "text/plain": {
                "examples": {
                  "badTeam": {
                    "summary": "Bad team",
                    "value": "Bad team"
                  },
                  "missingDates": {
                    "summary": "Missing dates",
                    "value": "Bad params: startDate and endDate are required"
                  },
                  "invalidChannels": {
                    "summary": "Invalid channels format",
                    "value": "Bad params: channels must be a valid array"
                  },
                  "invalidChannelValues": {
                    "summary": "Invalid channel values",
                    "value": "Bad params: channels must be empty or contain \"others\", \"email\" or \"linkedin\""
                  },
                  "invalidAB": {
                    "summary": "Invalid A/B selection",
                    "value": "Bad params: ABSelected must be A or B"
                  },
                  "invalidSendUserFormat": {
                    "summary": "Invalid send user format",
                    "value": "Bad param format: sendUser must be formatted as follow: <sendUserId>|<sendUserEmail>"
                  },
                  "invalidSendUser": {
                    "summary": "Send user email mismatch",
                    "value": "Bad params: the send user email is not related to the send user id"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Campaign not found",
            "content": {
              "text/plain": {
                "example": "Campaign not found"
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "text/plain": {
                "example": "Bad method"
              }
            }
          }
        }
      }
    },
    "/v2/campaigns/stats/batch": {
      "post": {
        "summary": "Get Batch Campaign Stats",
        "tags": [
          "Campaigns"
        ],
        "description": "Retrieve detailed statistics for multiple campaigns in a single request, with filtering options by date, user, A/B testing, and communication channels. Processes up to 100 campaigns per request.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "campaignIds",
                  "startDate",
                  "endDate"
                ],
                "properties": {
                  "campaignIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1,
                    "maxItems": 100,
                    "description": "Array of campaign IDs to retrieve stats for",
                    "example": [
                      "cam_123",
                      "cam_456"
                    ]
                  },
                  "startDate": {
                    "type": "string",
                    "description": "Start date in ISO 8601 format",
                    "example": "2024-01-07T22:00:00.000Z"
                  },
                  "endDate": {
                    "type": "string",
                    "description": "End date in ISO 8601 format",
                    "example": "2025-07-10T21:59:59.999Z"
                  },
                  "sendUser": {
                    "type": "string",
                    "description": "Filter stats by send user. Format: `sendUserId|sendUserEmail`. The sendUserId should begin with 'usr_' and the sendUserEmail should be a valid sender email. If the param is specified, both sendUserId and sendUserEmail are mandatory.",
                    "example": "usr_OcIHizJyIeaDxicQP|email@example.com"
                  },
                  "ABSelected": {
                    "type": "string",
                    "enum": [
                      "A",
                      "B"
                    ],
                    "description": "A/B version filter"
                  },
                  "channels": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "email",
                        "linkedin",
                        "others"
                      ]
                    },
                    "description": "Filter by communication channels"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "description": "Array of campaign stats results",
                      "items": {
                        "type": "object",
                        "properties": {
                          "campaignId": {
                            "type": "string",
                            "description": "The campaign ID"
                          },
                          "nbLeads": {
                            "type": "integer",
                            "description": "Total number of leads in the campaign"
                          },
                          "nbLeadsLaunched": {
                            "type": "integer",
                            "description": "Number of leads launched in the campaign"
                          },
                          "nbLeadsReached": {
                            "type": "integer",
                            "description": "Number of leads that were successfully reached"
                          },
                          "nbLeadsOpened": {
                            "type": "integer",
                            "description": "Number of leads that opened messages"
                          },
                          "nbLeadsInteracted": {
                            "type": "integer",
                            "description": "Number of leads that interacted with messages (clicked, replied)"
                          },
                          "nbLeadsAnswered": {
                            "type": "integer",
                            "description": "Number of leads that answered"
                          },
                          "nbLeadsInterested": {
                            "type": "integer",
                            "description": "Number of leads marked as interested"
                          },
                          "nbLeadsNotInterested": {
                            "type": "integer",
                            "description": "Number of leads marked as not interested"
                          },
                          "nbLeadsUnsubscribed": {
                            "type": "integer",
                            "description": "Number of leads that unsubscribed"
                          },
                          "nbLeadsInterrupted": {
                            "type": "integer",
                            "description": "Number of leads with interrupted sequences"
                          },
                          "messagesSent": {
                            "type": "integer",
                            "description": "Total number of messages sent"
                          },
                          "messagesNotSent": {
                            "type": "integer",
                            "description": "Number of messages that failed to send"
                          },
                          "messagesBounced": {
                            "type": "integer",
                            "description": "Number of messages that bounced"
                          },
                          "delivered": {
                            "type": "integer",
                            "description": "Number of messages successfully delivered"
                          },
                          "opened": {
                            "type": "integer",
                            "description": "Number of messages opened"
                          },
                          "clicked": {
                            "type": "integer",
                            "description": "Number of messages with clicks"
                          },
                          "replied": {
                            "type": "integer",
                            "description": "Number of messages that received replies"
                          },
                          "invitationAccepted": {
                            "type": "integer",
                            "description": "Number of LinkedIn invitations accepted"
                          },
                          "meetingBooked": {
                            "type": "integer",
                            "description": "Number of meetings booked"
                          },
                          "steps": {
                            "type": "array",
                            "description": "Detailed metrics for each step in the campaign",
                            "items": {
                              "type": "object",
                              "properties": {
                                "index": {
                                  "type": "integer",
                                  "description": "Step index in the sequence"
                                },
                                "sequenceId": {
                                  "type": "string",
                                  "description": "ID of the sequence"
                                },
                                "sequenceStep": {
                                  "type": "integer",
                                  "description": "Step number within the sequence"
                                },
                                "abTest": {
                                  "type": "string",
                                  "description": "A/B test variant (if applicable)"
                                },
                                "taskType": {
                                  "type": "string",
                                  "description": "Type of task",
                                  "enum": [
                                    "email",
                                    "linkedinVisit",
                                    "linkedinInvite",
                                    "linkedinSend",
                                    "phone",
                                    "manual",
                                    "conditional"
                                  ]
                                },
                                "conditionLabel": {
                                  "type": "string",
                                  "description": "Label for conditional steps"
                                },
                                "invited": {
                                  "type": "integer",
                                  "description": "Number of LinkedIn invitations sent"
                                },
                                "sent": {
                                  "type": "integer",
                                  "description": "Number of messages sent"
                                },
                                "delivered": {
                                  "type": "integer",
                                  "description": "Number of messages delivered"
                                },
                                "opened": {
                                  "type": "integer",
                                  "description": "Number of messages opened"
                                },
                                "clicked": {
                                  "type": "integer",
                                  "description": "Number of clicks from a message from this step"
                                },
                                "replied": {
                                  "type": "integer",
                                  "description": "Number of replies"
                                },
                                "notDelivered": {
                                  "type": "integer",
                                  "description": "Number of messages not delivered"
                                },
                                "bounced": {
                                  "type": "integer",
                                  "description": "Number of messages bounced"
                                },
                                "unsubscribed": {
                                  "type": "integer",
                                  "description": "Number of unsubscribes from this step"
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "errors": {
                      "type": "array",
                      "description": "Array of errors for campaigns that failed to retrieve stats",
                      "items": {
                        "type": "object",
                        "properties": {
                          "campaignId": {
                            "type": "string",
                            "description": "The campaign ID that failed"
                          },
                          "error": {
                            "type": "string",
                            "description": "Error message"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "results": [
                    {
                      "campaignId": "cam_123",
                      "nbLeads": 32,
                      "nbLeadsLaunched": 32,
                      "nbLeadsReached": 32,
                      "nbLeadsOpened": 31,
                      "nbLeadsInteracted": 4,
                      "nbLeadsAnswered": 16,
                      "nbLeadsInterested": 1,
                      "nbLeadsNotInterested": 0,
                      "nbLeadsUnsubscribed": 1,
                      "nbLeadsInterrupted": 1,
                      "messagesSent": 72,
                      "messagesNotSent": 0,
                      "messagesBounced": 0,
                      "delivered": 72,
                      "opened": 47,
                      "clicked": 4,
                      "replied": 16,
                      "invitationAccepted": 0,
                      "meetingBooked": 0,
                      "steps": [
                        {
                          "index": 1,
                          "sequenceId": "seq_rH5RD3fMkkt2gM3YC",
                          "sequenceStep": 0,
                          "taskType": "linkedinSend",
                          "invited": 0,
                          "sent": 32,
                          "delivered": 32,
                          "opened": 15,
                          "clicked": 0,
                          "replied": 15,
                          "notDelivered": 0,
                          "bounced": 0,
                          "unsubscribed": 1
                        }
                      ]
                    }
                  ],
                  "errors": []
                }
              }
            }
          },
          "400": {
            "description": "Bad request - Invalid parameters",
            "content": {
              "text/plain": {
                "examples": {
                  "emptyCampaignIds": {
                    "summary": "Empty campaign IDs",
                    "value": "Bad params: campaignIds must be a non-empty array"
                  },
                  "tooManyCampaignIds": {
                    "summary": "Too many campaign IDs",
                    "value": "Bad params: campaignIds must contain at most 100 items"
                  },
                  "missingDates": {
                    "summary": "Missing dates",
                    "value": "Bad params: startDate and endDate are required"
                  },
                  "invalidChannels": {
                    "summary": "Invalid channels",
                    "value": "Bad params: channels must be an array of \"others\", \"email\" or \"linkedin\""
                  },
                  "invalidAB": {
                    "summary": "Invalid A/B selection",
                    "value": "Bad params: ABSelected must be A or B"
                  },
                  "invalidSendUserFormat": {
                    "summary": "Invalid send user format",
                    "value": "Bad param format: sendUser must be formatted as follow: <sendUserId>|<sendUserEmail>"
                  },
                  "invalidSendUser": {
                    "summary": "Send user email mismatch",
                    "value": "Bad params: the send user email is not related to the send user id"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "text/plain": {
                "example": "Bad method"
              }
            }
          }
        }
      }
    },
    "/unsubscribes": {
      "get": {
        "deprecated": true,
        "summary": "Get Many Unsubscribes",
        "tags": [
          "Unsubscribes"
        ],
        "parameters": [
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Offset for pagination",
            "example": "0",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Number of unsubscribes to retrieve. Default: 100",
            "example": "5",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Unsubscribe"
                  }
                },
                "example": [
                  {
                    "_id": "uns_ZfdZWc7dvCqXdgQmb",
                    "createdAt": "2023-06-12T10:45:21.367Z",
                    "value": "john.doe@example.com",
                    "source": "user"
                  }
                ]
              }
            }
          },
          "400": {
            "description": "No API key provided",
            "content": {
              "text/plain": {
                "example": "No API key provided"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "403": {
            "description": "User linked to this API key is blocked",
            "content": {
              "text/plain": {
                "example": "User linked to this API key is blocked"
              }
            }
          },
          "404": {
            "description": "No user found for this API key",
            "content": {
              "text/plain": {
                "example": "No user found for this API key"
              }
            }
          }
        }
      }
    },
    "/unsubs/export": {
      "get": {
        "deprecated": true,
        "summary": "Export Unsubscribes",
        "tags": [
          "Unsubscribes"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/csv": {
                "example": "value,source,createdAt\nwilliam.davis@fake.org,lead,2019-12-19T21:56:34.672Z\nemma.johnson@sample.com,abuse,2020-09-30T08:34:17.298Z\nmichael.brown@domain.net,api,2021-03-12T14:12:56.534Z\njane.smith@example.org,bounce,2022-11-23T18:23:45.890Z\njohn.doe@example.com,user,2023-06-15T10:45:21.367Z\nalice.brown@domainexample.com,lead,2023-07-21T09:14:25.521Z\nbob.smith@example.net,user,2023-08-01T17:34:43.679Z\ncharlie.doe@mockmail.com,api,2023-09-12T11:05:37.874Z\ndavid.jones@sampledomain.org,abuse,2023-10-05T15:23:54.129Z\neve.wilson@fakemail.com,bounce,2024-01-07T08:19:45.213Z"
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/v2/unsubscribes/variables": {
      "get": {
        "summary": "List Unsubscribed Variables",
        "description": "Retrieves a paginated list of all unsubscribed variables (emails, domains, LinkedIn URLs, phone numbers).",
        "tags": [
          "Unsubscribes"
        ],
        "parameters": [
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Number of entries to skip for pagination",
            "example": "0",
            "schema": {
              "type": "integer",
              "default": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Number of entries to return (max 100)",
            "example": "50",
            "schema": {
              "type": "integer",
              "default": 100,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UnsubscribedVariable"
                  }
                },
                "example": [
                  {
                    "_id": "uns_ZfdZWc7dvCqXdgQmb",
                    "value": "john.doe@example.com",
                    "source": "user",
                    "createdAt": "2023-06-12T10:45:21.367Z"
                  }
                ]
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      },
      "post": {
        "summary": "Bulk Unsubscribe Variables",
        "description": "Unsubscribes up to 10,000 variables in a single request.",
        "tags": [
          "Unsubscribes"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "values"
                ],
                "properties": {
                  "values": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "List of variables to unsubscribe (emails, domains, LinkedIn URLs, or phone numbers). Maximum 10,000 values.",
                    "maxItems": 10000
                  }
                }
              },
              "example": {
                "values": [
                  "john.doe@example.com",
                  "@example.org",
                  "+1234567890"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": "Variables unsubscribed"
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "text/plain": {
                "example": "Maximum 10000 values allowed"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/v2/unsubscribes/variables/{value}": {
      "get": {
        "summary": "Get Unsubscribed Variable",
        "description": "Retrieves a specific unsubscribed variable by its value.",
        "tags": [
          "Unsubscribes"
        ],
        "parameters": [
          {
            "name": "value",
            "in": "path",
            "required": true,
            "description": "The variable value (email, domain, LinkedIn URL, or phone number)",
            "example": "john.doe@example.com",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string",
                      "description": "Unique identifier"
                    },
                    "value": {
                      "type": "string",
                      "description": "The unsubscribed variable"
                    },
                    "variable": {
                      "type": "string",
                      "description": "Alias of value"
                    },
                    "source": {
                      "type": "string",
                      "description": "Origin of the unsubscription",
                      "enum": [
                        "api",
                        "bounced",
                        "lead",
                        "user",
                        "abuse"
                      ]
                    }
                  }
                },
                "example": {
                  "_id": "uns_ZfdZWc7dvCqXdgQmb",
                  "value": "john.doe@example.com",
                  "variable": "john.doe@example.com",
                  "source": "user"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "text/plain": {
                "example": "No value"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Variable not found",
            "content": {
              "text/plain": {
                "example": "Variable not found"
              }
            }
          }
        }
      },
      "post": {
        "summary": "Unsubscribe Variable",
        "description": "Unsubscribes a single variable. This operation is idempotent — if the variable is already unsubscribed, the existing record is returned.",
        "tags": [
          "Unsubscribes"
        ],
        "parameters": [
          {
            "name": "value",
            "in": "path",
            "required": true,
            "description": "The variable value to unsubscribe (email, domain, LinkedIn URL, or phone number)",
            "example": "john.doe@example.com",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string",
                      "description": "Unique identifier"
                    },
                    "value": {
                      "type": "string",
                      "description": "The unsubscribed variable"
                    },
                    "variable": {
                      "type": "string",
                      "description": "Alias of value"
                    },
                    "source": {
                      "type": "string",
                      "description": "Origin of the unsubscription",
                      "enum": [
                        "api",
                        "bounced",
                        "lead",
                        "user",
                        "abuse"
                      ]
                    }
                  }
                },
                "example": {
                  "_id": "uns_ZfdZWc7dvCqXdgQmb",
                  "value": "john.doe@example.com",
                  "variable": "john.doe@example.com",
                  "source": "api"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "text/plain": {
                "example": "No value"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Server error",
            "content": {
              "text/plain": {
                "example": "Failed to unsubscribe variable"
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Re-subscribe Variable",
        "description": "Removes a variable from the unsubscribe list. Variables with a protected source (LEAD or ABUSE) cannot be re-subscribed.",
        "tags": [
          "Unsubscribes"
        ],
        "parameters": [
          {
            "name": "value",
            "in": "path",
            "required": true,
            "description": "The variable value to re-subscribe",
            "example": "john.doe@example.com",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": "Variable subscribed"
              }
            }
          },
          "400": {
            "description": "Variable not found in unsubscribe list",
            "content": {
              "text/plain": {
                "example": "Variable not found in unsubscribe list"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "409": {
            "description": "Variable is protected (source is LEAD or ABUSE) and cannot be re-subscribed",
            "content": {
              "text/plain": {
                "example": "Variable is protected and cannot be re-subscribed"
              }
            }
          }
        }
      }
    },
    "/v2/unsubscribes/contacts/{contactId}": {
      "get": {
        "summary": "Get Contact Subscription Status",
        "description": "Checks whether a contact is unsubscribed (do-not-contact).",
        "tags": [
          "Unsubscribes"
        ],
        "parameters": [
          {
            "name": "contactId",
            "in": "path",
            "required": true,
            "description": "The contact identifier",
            "example": "con_aB1cD2eF3gH4iJ5kL",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactSubscriptionStatus"
                },
                "example": {
                  "_id": "con_aB1cD2eF3gH4iJ5kL",
                  "doNotContact": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "text/plain": {
                "example": "Bad contact identifier"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Server error",
            "content": {
              "text/plain": {
                "example": "Failed to get contact subscription"
              }
            }
          }
        }
      },
      "post": {
        "summary": "Unsubscribe Contact",
        "description": "Marks a contact as unsubscribed (do-not-contact).",
        "tags": [
          "Unsubscribes"
        ],
        "parameters": [
          {
            "name": "contactId",
            "in": "path",
            "required": true,
            "description": "The contact identifier",
            "example": "con_aB1cD2eF3gH4iJ5kL",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": "Contact subscription updated"
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "text/plain": {
                "example": "Bad contact identifier"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Server error",
            "content": {
              "text/plain": {
                "example": "Failed to update contact subscription"
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Re-subscribe Contact",
        "description": "Removes the unsubscribed (do-not-contact) flag from a contact.",
        "tags": [
          "Unsubscribes"
        ],
        "parameters": [
          {
            "name": "contactId",
            "in": "path",
            "required": true,
            "description": "The contact identifier",
            "example": "con_aB1cD2eF3gH4iJ5kL",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "example": "Contact subscription updated"
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "text/plain": {
                "example": "Bad contact identifier"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Server error",
            "content": {
              "text/plain": {
                "example": "Failed to update contact subscription"
              }
            }
          }
        }
      }
    },
    "/v2/unsubscribes/exports/variables": {
      "get": {
        "summary": "Export Unsubscribed Variables",
        "description": "Exports all unsubscribed variables to a CSV file.",
        "tags": [
          "Unsubscribes"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/csv": {
                "example": "_id,value,source,createdAt\nuns_ZfdZWc7dvCqXdgQmb,john.doe@example.com,user,2023-06-12T10:45:21.367Z\nuns_fH5gNhZnIpnwRlxZw,@example.org,api,2023-07-21T09:14:25.521Z"
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/v2/unsubscribes/exports/contacts": {
      "get": {
        "summary": "Export Unsubscribed Contacts",
        "description": "Exports all contacts with their subscription status to a CSV file.",
        "tags": [
          "Unsubscribes"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/csv": {
                "example": "_id,doNotContact\ncon_aB1cD2eF3gH4iJ5kL,true\ncon_mN6oP7qR8sT9uV0wX,false"
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      }
    },
    "/unsubscribes/{email}": {
      "get": {
        "deprecated": true,
        "summary": "Get Unsubscribe by Email",
        "tags": [
          "Unsubscribes"
        ],
        "parameters": [
          {
            "name": "email",
            "in": "path",
            "required": true,
            "description": "Email address to check unsubscribe status",
            "example": "john.doe@domain.com",
            "schema": {
              "type": "string",
              "format": "email"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string",
                      "description": "Unique identifier for the unsubscribe entry"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Timestamp when the unsubscribe entry was created"
                    },
                    "value": {
                      "type": "string",
                      "description": "The unsubscribed email address"
                    },
                    "source": {
                      "type": "string",
                      "description": "Source of the unsubscribe (e.g., user, lead, abuse, bounce, api)"
                    }
                  }
                },
                "example": {
                  "_id": "uns_ZfdZWc7dvCqXdgQmb",
                  "createdAt": "2023-06-12T10:45:21.367Z",
                  "value": "john.doe@example.com",
                  "source": "user"
                }
              }
            }
          },
          "400": {
            "description": "No API key provided",
            "content": {
              "text/plain": {
                "example": "No API key provided"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "403": {
            "description": "User linked to this API key is blocked",
            "content": {
              "text/plain": {
                "example": "User linked to this API key is blocked"
              }
            }
          },
          "404": {
            "description": "Possible errors: No user found for this API key / Unsubscriber not found",
            "content": {
              "text/plain": {
                "example": "No user found for this API key"
              }
            }
          },
          "500": {
            "description": "Possible errors: Invalid value / Invalid email address or domain / Invalid email address or domain. Domains must start with @"
          }
        }
      },
      "post": {
        "deprecated": true,
        "summary": "Add Unsubscribe Email or Domain",
        "tags": [
          "Unsubscribes"
        ],
        "parameters": [
          {
            "name": "email",
            "in": "path",
            "required": true,
            "description": "Email address to add to the unsubscribes",
            "example": "john.doe@domain.com",
            "schema": {
              "type": "string",
              "format": "email"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string",
                      "description": "Unique identifier for the unsubscribe entry"
                    },
                    "value": {
                      "type": "string",
                      "format": "email",
                      "description": "The unsubscribed email address or domain"
                    },
                    "email": {
                      "type": "string",
                      "format": "email",
                      "description": "The unsubscribed email address"
                    }
                  },
                  "required": [
                    "_id",
                    "value"
                  ]
                },
                "example": {
                  "_id": "uns_fH5gNhZnIpnwRlxZw",
                  "value": "user@domain.com",
                  "email": "user@domain.com"
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Unsubscribe not found",
            "content": {
              "text/plain": {
                "example": "Unsubscribe not found"
              }
            }
          }
        }
      },
      "delete": {
        "deprecated": true,
        "summary": "Delete Unsubscribe Email",
        "tags": [
          "Unsubscribes"
        ],
        "parameters": [
          {
            "name": "email",
            "in": "path",
            "required": true,
            "description": "Email address to remove from the unsubscribes",
            "example": "john.doe@domain.com",
            "schema": {
              "type": "string",
              "format": "email"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string",
                      "description": "Unique identifier for the unsubscribe entry"
                    },
                    "value": {
                      "type": "string",
                      "format": "email",
                      "description": "The unsubscribed email address"
                    }
                  },
                  "required": [
                    "_id",
                    "value"
                  ]
                },
                "example": {
                  "_id": "uns_QCXCLzEfEuEOlCVIu",
                  "value": "john.doe@example.com"
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Unsubscribe not found",
            "content": {
              "text/plain": {
                "example": "Unsubscribe not found"
              }
            }
          }
        }
      }
    },
    "/hooks": {
      "get": {
        "summary": "Get Many Webhooks",
        "tags": [
          "Webhooks"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Webhook"
                  }
                },
                "example": [
                  {
                    "_id": "hoo_Ib5jfViX9hn3FzNqr",
                    "targetUrl": "https://hooks.zapier.com/hooks/standard/{accountId}/{webhookId}/",
                    "createdAt": "2018-06-05T09:07:07.761Z",
                    "zapId": 37709957,
                    "type": "emailsReplied",
                    "campaignId": "cam_FlN1hrYhADZUfspMs",
                    "isFirst": true
                  },
                  {
                    "_id": "hoo_SDRr2w4JigZDL7OB2",
                    "targetUrl": "https://hooks.zapier.com/hooks/standard/{accountId}/{webhookId}/",
                    "createdAt": "2019-06-05T14:38:56.535Z",
                    "zapId": 59825555,
                    "type": "emailsReplied",
                    "campaignId": "cam_h3jptAEeqFFpve5mr"
                  },
                  {
                    "_id": "hoo_IYAPP4HnSyU7UTH3E",
                    "targetUrl": "https://hooks.zapier.com/hooks/standard/{accountId}/{webhookId}/",
                    "createdAt": "2019-06-05T15:49:36.624Z",
                    "zapId": 59831776,
                    "type": "emailsReplied",
                    "campaignId": "cam_qBNYaIFXA77eXM1Ey",
                    "isFirst": true
                  },
                  {
                    "_id": "hoo_OQ1eCPucttlQV6uB4",
                    "targetUrl": "https://hooks.zapier.com/hooks/standard/{accountId}/{webhookId}/",
                    "createdAt": "2019-06-05T19:28:49.130Z",
                    "zapId": 59852716,
                    "type": "emailsReplied",
                    "campaignId": "cam_vRotI1zB0rgqEe0Hg",
                    "isFirst": true
                  },
                  {
                    "_id": "hoo_bOucNGG13uJhhIQ8g",
                    "targetUrl": "https://hooks.zapier.com/hooks/standard/{accountId}/{webhookId}/",
                    "createdAt": "2019-10-15T09:53:50.839Z",
                    "zapId": 47004696,
                    "type": "emailsOpened",
                    "campaignId": "cam_K6XNvvamP9QTotBC3"
                  },
                  {
                    "_id": "hoo_hZSI1GetoYUKu76TX",
                    "targetUrl": "https://hooks.zapier.com/hooks/standard/{accountId}/{webhookId}/",
                    "createdAt": "2019-10-15T09:56:24.197Z",
                    "zapId": 47004696,
                    "type": "emailsOpened",
                    "campaignId": "cam_K6XNvvamP9QTotBC3"
                  },
                  {
                    "_id": "hoo_anErg4PUSFTd3r3dX",
                    "targetUrl": "https://hooks.zapier.com/hooks/standard/{accountId}/{webhookId}/",
                    "createdAt": "2020-04-27T14:04:33.424Z",
                    "zapId": 85466371,
                    "type": "emailsReplied",
                    "campaignId": "cam_rpejDXyLkA2TSbXyC"
                  },
                  {
                    "_id": "hoo_Y3nL7UuQn85hIFTRV",
                    "targetUrl": "https://hooks.zapier.com/hooks/standard/{accountId}/{webhookId}/",
                    "createdAt": "2020-04-27T14:06:38.375Z",
                    "zapId": 85466371,
                    "type": "emailsReplied",
                    "campaignId": "cam_rpejDXyLkA2TSbXyC"
                  },
                  {
                    "_id": "hoo_UAtwcPAd0tK9U6hKG",
                    "targetUrl": "https://example.com/webhooks/{id}",
                    "createdAt": "2022-02-10T16:45:28.216Z",
                    "campaignId": "cam_7BE8IZRaqahU44Wp6"
                  }
                ]
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Webhook not found",
            "content": {
              "text/plain": {
                "example": "Webhook not found"
              }
            }
          }
        },
        "parameters": []
      },
      "post": {
        "summary": "Add Webhook",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "campaignId",
            "in": "query",
            "required": false,
            "description": "Webhook for specific campaign",
            "example": "cam_123",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "isFirst",
            "in": "query",
            "required": false,
            "description": "Webhook for first activity only",
            "example": "true",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "zapId",
            "in": "query",
            "required": false,
            "description": "Zapier ID",
            "example": "123456789",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "targetUrl": {
                    "type": "string",
                    "format": "uri",
                    "description": "The URL that will receive webhook POST requests."
                  },
                  "type": {
                    "type": "string",
                    "description": "Optional event type to subscribe to. When omitted, all events are sent. See the full categorized list in the endpoint documentation.",
                    "enum": [
                      "contacted",
                      "hooked",
                      "attracted",
                      "warmed",
                      "interested",
                      "notInterested",
                      "emailsSent",
                      "emailsOpened",
                      "emailsClicked",
                      "emailsReplied",
                      "emailsBounced",
                      "emailsFailed",
                      "emailsInterested",
                      "emailsNotInterested",
                      "emailsUnsubscribed",
                      "linkedinSent",
                      "linkedinOpened",
                      "linkedinReplied",
                      "linkedinInterested",
                      "linkedinNotInterested",
                      "linkedinSendFailed",
                      "linkedinVisitDone",
                      "linkedinVisitFailed",
                      "linkedinFollowDone",
                      "linkedinFollowFailed",
                      "linkedinFollowSkipped",
                      "linkedinInviteDone",
                      "linkedinInviteFailed",
                      "linkedinInviteAccepted",
                      "linkedinEndorseDone",
                      "linkedinEndorseFailed",
                      "linkedinEndorseSkipped",
                      "linkedinVoiceNoteDone",
                      "linkedinVoiceNoteFailed",
                      "linkedinLikeLastPostDone",
                      "linkedinLikeLastPostNoPost",
                      "linkedinLikeLastPostFailed",
                      "linkedinWithdrawInvitationDone",
                      "linkedinWithdrawInvitationFailed",
                      "whatsappMessageSent",
                      "whatsappMessageDelivered",
                      "whatsappMessageOpened",
                      "whatsappReplied",
                      "whatsappMessageFailed",
                      "smsSent",
                      "smsDelivered",
                      "smsReplied",
                      "smsFailed",
                      "aircallCreated",
                      "aircallEnded",
                      "aircallDone",
                      "aircallInterested",
                      "aircallNotInterested",
                      "apiDone",
                      "apiInterested",
                      "apiNotInterested",
                      "apiFailed",
                      "manualInterested",
                      "manualNotInterested",
                      "paused",
                      "resumed",
                      "stopped",
                      "campaignComplete",
                      "customDomainErrors",
                      "connectionIssue",
                      "sendLimitReached",
                      "lemwarmPaused",
                      "annotated",
                      "enrichmentDone",
                      "enrichmentError",
                      "callRecordingDone",
                      "callTranscriptDone",
                      "inboxLabelUpdated",
                      "signalRegistered",
                      "deliverabilityAlertTriggered"
                    ]
                  },
                  "secret": {
                    "type": "string",
                    "description": "Optional shared secret. Stored encrypted, never returned by GET, and immutable once set. Sent back to your endpoint as a `secret` field in the body of every webhook call so you can verify the request originated from lemlist."
                  }
                },
                "required": [
                  "targetUrl"
                ]
              },
              "example": {
                "targetUrl": "https://webhook.site/00000000-0000-0000-0000-000000000000",
                "type": "linkedinInterested",
                "secret": "s3cret-shared-with-my-endpoint"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string",
                      "description": "Unique identifier for the webhook"
                    },
                    "targetUrl": {
                      "type": "string",
                      "description": "The URL where the webhook will send data"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Timestamp when the webhook was created"
                    },
                    "type": {
                      "type": "string",
                      "description": "Type of webhook event"
                    }
                  }
                },
                "example": {
                  "_id": "hoo_GvYkkWIcdPf2WsBDY",
                  "targetUrl": "https://n8n.example.com/webhook/lemlist-webhook-surprise",
                  "createdAt": "2025-10-29T00:47:42.035Z",
                  "type": "linkedinInterested"
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Webhook not found",
            "content": {
              "text/plain": {
                "example": "Webhook not found"
              }
            }
          }
        }
      }
    },
    "/hooks/{hookId}": {
      "delete": {
        "summary": "Delete Webhook",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "hookId",
            "in": "path",
            "required": true,
            "description": "Unique webhook ID",
            "example": "hoo_123",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string",
                      "description": "Unique identifier for the webhook"
                    },
                    "targetUrl": {
                      "type": "string",
                      "description": "The URL where the webhook will send data"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Timestamp when the webhook was created"
                    },
                    "type": {
                      "type": "string",
                      "description": "Type of webhook event"
                    },
                    "campaignId": {
                      "type": "string",
                      "description": "Associated campaign ID, if applicable"
                    }
                  }
                },
                "example": {
                  "_id": "hoo_fmpVMoBhrEHtw3cgy",
                  "targetUrl": "https://n8n.example.com/webhook/lemlist-webhook-surprise",
                  "createdAt": "2024-07-11T13:55:06.276Z",
                  "type": "linkedinInterested",
                  "campaignId": "cam_A1B2C3D4E5F6G7H8I9"
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Webhook not found",
            "content": {
              "text/plain": {
                "example": "Webhook not found"
              }
            }
          }
        }
      }
    },
    "/enrich/{enrichId}": {
      "get": {
        "summary": "Get Enrichment Result",
        "tags": [
          "Enrich"
        ],
        "parameters": [
          {
            "name": "enrichId",
            "in": "path",
            "required": true,
            "description": "Unique enrichment ID",
            "example": "enr_123",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "enrichmentId": "enr_FPgMU8ZUVBnOZBuZ6",
                  "enrichmentStatus": "done",
                  "input": {
                    "firstName": "John",
                    "lastName": "lemlist",
                    "linkedinUrl": "https://www.linkedin.com/in/lemlist",
                    "companyName": "lemlist",
                    "companyDomain": "lemlist.com"
                  },
                  "data": {
                    "email": {
                      "email": "john@lemlist.co",
                      "notFound": false
                    }
                  }
                }
              }
            }
          },
          "202": {
            "description": "In progress"
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Enrichment not found",
            "content": {
              "text/plain": {
                "example": "Enrichment not found"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/enrich": {
      "post": {
        "summary": "Enrich Data",
        "tags": [
          "Enrich"
        ],
        "parameters": [
          {
            "name": "findEmail",
            "in": "query",
            "required": false,
            "description": "Find verified email",
            "example": "true",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "verifyEmail",
            "in": "query",
            "required": false,
            "description": "Verify existing email",
            "example": "true",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "linkedinEnrichment",
            "in": "query",
            "required": false,
            "description": "Run LinkedIn enrichment",
            "example": "true",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "email",
            "in": "query",
            "required": false,
            "description": "Email address",
            "example": "john@example.com",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "linkedinUrl",
            "in": "query",
            "required": false,
            "description": "LinkedIn URL",
            "example": "https://www.linkedin.com/in/john-doe",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "firstName",
            "in": "query",
            "required": false,
            "description": "First name",
            "example": "John",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lastName",
            "in": "query",
            "required": false,
            "description": "Last name",
            "example": "Doe",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "companyDomain",
            "in": "query",
            "required": false,
            "description": "Company domain",
            "example": "example.com",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "companyName",
            "in": "query",
            "required": false,
            "description": "Company name",
            "example": "Acme Inc",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "jobTitle",
            "in": "query",
            "required": false,
            "description": "Job title of the person. Optional hint that improves the find rate when matching the right person.",
            "example": "Marketing Manager",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "findPhone",
            "in": "query",
            "required": false,
            "description": "Find phone number",
            "example": "true",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "webhookUrl",
            "in": "query",
            "required": false,
            "description": "Webhook URL for enrichment events",
            "example": "https://webhook.site/*your-webhook-id*/",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "id": "enr_CzQDYYcS5vDG1ZvQi"
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / Bad request / No enrichment requested (findEmail, findPhone, linkedinEnrichment or verifyEmail required) / Invalid webhookUrl",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/v2/enrichments/bulk": {
      "post": {
        "summary": "Bulk Enrich Data",
        "tags": [
          "Enrich"
        ],
        "description": "Send a batch of enrichment requests for multiple entities. Maximum 500 enrichment requests per call.",
        "parameters": [
          {
            "name": "webhookUrl",
            "in": "query",
            "required": false,
            "description": "Webhook URL for enrichment events",
            "example": "https://n8n.example.com/webhook/lemlist-webhook-surprise",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "maxItems": 500,
                "items": {
                  "type": "object",
                  "required": [
                    "enrichmentRequests"
                  ],
                  "properties": {
                    "input": {
                      "type": "object",
                      "description": "Input data for enrichment. Required fields depend on enrichmentRequests.",
                      "properties": {
                        "linkedinUrl": {
                          "type": "string",
                          "description": "The LinkedIn URL of the person",
                          "example": "https://www.linkedin.com/in/john-doe"
                        },
                        "email": {
                          "type": "string",
                          "description": "The email of the person",
                          "example": "john.doe@example.com"
                        },
                        "companyName": {
                          "type": "string",
                          "description": "The name of the company associated with the person",
                          "example": "Example Company"
                        },
                        "companyDomain": {
                          "type": "string",
                          "description": "The domain of the company associated with the person. Recommended for better find rate",
                          "example": "example.com"
                        },
                        "firstName": {
                          "type": "string",
                          "description": "The first name of the person",
                          "example": "John"
                        },
                        "lastName": {
                          "type": "string",
                          "description": "The last name of the person",
                          "example": "Doe"
                        },
                        "jobTitle": {
                          "type": "string",
                          "description": "The job title of the person. Optional hint that improves the find rate when matching the right person.",
                          "example": "Marketing Manager"
                        }
                      }
                    },
                    "enrichmentRequests": {
                      "type": "array",
                      "description": "Array of enrichment types to perform. Must contain at least one of: find_email, find_phone, verify, linkedin_enrichment",
                      "items": {
                        "type": "string",
                        "enum": [
                          "find_email",
                          "find_phone",
                          "verify",
                          "linkedin_enrichment"
                        ]
                      },
                      "example": [
                        "find_email",
                        "verify"
                      ]
                    },
                    "metadata": {
                      "description": "Custom data to be returned in the response and webhook. Can be a string or an object",
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        }
                      ],
                      "example": {
                        "id": "some_id"
                      }
                    }
                  }
                }
              },
              "examples": {
                "find_email": {
                  "summary": "Find email enrichment",
                  "value": [
                    {
                      "input": {
                        "companyName": "Example Ets",
                        "companyDomain": "example.com",
                        "firstName": "John",
                        "lastName": "Doe"
                      },
                      "enrichmentRequests": [
                        "find_email"
                      ],
                      "metadata": {
                        "id": "some_id"
                      }
                    },
                    {
                      "input": {
                        "linkedinUrl": "https://www.linkedin.com/in/john-doe"
                      },
                      "enrichmentRequests": [
                        "find_email"
                      ],
                      "metadata": "some_id"
                    }
                  ]
                },
                "find_phone": {
                  "summary": "Find phone enrichment",
                  "value": [
                    {
                      "input": {
                        "linkedinUrl": "https://www.linkedin.com/in/john-doe"
                      },
                      "enrichmentRequests": [
                        "find_phone"
                      ],
                      "metadata": {
                        "id": "some_id"
                      }
                    }
                  ]
                },
                "verify": {
                  "summary": "Verify email",
                  "value": [
                    {
                      "input": {
                        "email": "john.doe@example.com"
                      },
                      "enrichmentRequests": [
                        "verify"
                      ],
                      "metadata": {
                        "id": "some_id"
                      }
                    }
                  ]
                },
                "linkedin_enrichment": {
                  "summary": "LinkedIn enrichment",
                  "value": [
                    {
                      "input": {
                        "linkedinUrl": "https://www.linkedin.com/in/john-doe"
                      },
                      "enrichmentRequests": [
                        "linkedin_enrichment"
                      ],
                      "metadata": {
                        "id": "some_id"
                      }
                    }
                  ]
                },
                "multiple": {
                  "summary": "Multiple enrichments",
                  "value": [
                    {
                      "input": {
                        "linkedinUrl": "https://www.linkedin.com/in/john-doe",
                        "email": "john.doe@example.com",
                        "companyName": "Example Company",
                        "companyDomain": "example.com",
                        "firstName": "John",
                        "lastName": "Doe",
                        "jobTitle": "Marketing Manager"
                      },
                      "enrichmentRequests": [
                        "find_email",
                        "find_phone",
                        "verify",
                        "linkedin_enrichment"
                      ],
                      "metadata": {
                        "some_id": "some_id"
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success - Returns enrichment IDs and metadata for each request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Enrichment ID",
                            "example": "enr_KzCb0f9dbIjtRqyEO"
                          },
                          "metadata": {
                            "description": "The metadata provided in the request",
                            "oneOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "object"
                              }
                            ]
                          }
                        }
                      },
                      {
                        "type": "object",
                        "properties": {
                          "error": {
                            "type": "string",
                            "description": "Error code for failed enrichment",
                            "example": "MISSING_INPUTS"
                          },
                          "metadata": {
                            "description": "The metadata provided in the request",
                            "oneOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "object"
                              }
                            ]
                          }
                        }
                      }
                    ]
                  }
                },
                "examples": {
                  "find_email": {
                    "summary": "Find email response",
                    "value": [
                      {
                        "id": "enr_rt3yG1uvSOAmNgsOm",
                        "metadata": {
                          "id": "some_id"
                        }
                      },
                      {
                        "id": "enr_KdG7p3VNyiCgmcYTv",
                        "metadata": "some_id"
                      },
                      {
                        "error": "MISSING_INPUTS",
                        "metadata": "some_id"
                      }
                    ]
                  },
                  "find_phone": {
                    "summary": "Find phone response",
                    "value": [
                      {
                        "id": "enr_bPawymIrM37F6yHBe",
                        "metadata": {
                          "id": "some_id"
                        }
                      },
                      {
                        "error": "MISSING_INPUTS",
                        "metadata": "some_id"
                      }
                    ]
                  },
                  "verify": {
                    "summary": "Verify email response",
                    "value": [
                      {
                        "id": "enr_N84uOiUB0RYx5LIEb",
                        "metadata": {
                          "id": "some_id"
                        }
                      },
                      {
                        "error": "MISSING_EMAIL",
                        "metadata": "some_id"
                      }
                    ]
                  },
                  "linkedin_enrichment": {
                    "summary": "LinkedIn enrichment response",
                    "value": [
                      {
                        "id": "enr_zsHo0j5j6HNC0MXgQ",
                        "metadata": {
                          "id": "some_id"
                        }
                      },
                      {
                        "error": "MISSING_LINKEDIN_URL",
                        "metadata": "some_id"
                      }
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - Invalid input format or parameters",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "enum": [
                        "WRONG_INPUT_FORMAT",
                        "WRONG_METADATA_FORMAT",
                        "NO_WORKFLOW_REQUESTED",
                        "WRONG_ENRICHMENT_REQUEST_FORMAT",
                        "UNAUTHORIZED_WORKFLOW_REQUESTED",
                        "TOO_MANY_ENRICHMENTS_REQUESTED",
                        "NO_ENRICHMENTS_REQUESTED",
                        "WRONG_BODY_FORMAT"
                      ]
                    }
                  }
                },
                "examples": {
                  "wrong_input_format": {
                    "summary": "Wrong input format",
                    "description": "The input of each enrichment must be an object containing at least one of the required fields",
                    "value": {
                      "error": "WRONG_INPUT_FORMAT"
                    }
                  },
                  "wrong_metadata_format": {
                    "summary": "Wrong metadata format",
                    "description": "The metadata field must be a string or an object",
                    "value": {
                      "error": "WRONG_METADATA_FORMAT"
                    }
                  },
                  "no_workflow_requested": {
                    "summary": "No workflow requested",
                    "description": "The enrichment request must contain at least one of the authorized workflows (find_email, find_phone, verify, linkedin_enrichment)",
                    "value": {
                      "error": "NO_WORKFLOW_REQUESTED"
                    }
                  },
                  "wrong_enrichment_request_format": {
                    "summary": "Wrong enrichment request format",
                    "description": "The enrichment request must be an array",
                    "value": {
                      "error": "WRONG_ENRICHMENT_REQUEST_FORMAT"
                    }
                  },
                  "unauthorized_workflow_requested": {
                    "summary": "Unauthorized workflow requested",
                    "description": "The enrichmentRequests contained invalid request types",
                    "value": {
                      "error": "UNAUTHORIZED_WORKFLOW_REQUESTED"
                    }
                  },
                  "too_many_enrichments_requested": {
                    "summary": "Too many enrichments requested",
                    "description": "There is a limit of 500 enrichments per request",
                    "value": {
                      "error": "TOO_MANY_ENRICHMENTS_REQUESTED"
                    }
                  },
                  "no_enrichments_requested": {
                    "summary": "No enrichments requested",
                    "description": "The body must contain at least one enrichment request",
                    "value": {
                      "error": "NO_ENRICHMENTS_REQUESTED"
                    }
                  },
                  "wrong_body_format": {
                    "summary": "Wrong body format",
                    "description": "The body must be a valid array",
                    "value": {
                      "error": "WRONG_BODY_FORMAT"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/leads/{leadId}/enrich": {
      "post": {
        "summary": "Enrich Lead",
        "tags": [
          "Enrich"
        ],
        "parameters": [
          {
            "name": "leadId",
            "in": "path",
            "required": true,
            "description": "Unique lead ID",
            "example": "lea_123",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "findEmail",
            "in": "query",
            "required": false,
            "description": "Search email address in another campaign",
            "example": "true",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "verifyEmail",
            "in": "query",
            "required": false,
            "description": "Find verified email",
            "example": "true",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "linkedinEnrichment",
            "in": "query",
            "required": false,
            "description": "Run LinkedIn enrichment",
            "example": "true",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "findPhone",
            "in": "query",
            "required": false,
            "description": "Find phone number",
            "example": "true",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "webhookUrl",
            "in": "query",
            "required": false,
            "description": "Webhook URL for enrichment events",
            "example": "https://n8n.example.com/webhook/lemlist-webhook-surprise",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "force",
            "in": "query",
            "required": false,
            "description": "Re-run an enrichment that would otherwise be skipped. Bypasses skips caused by data already present on the contact: existing email, existing phone, LinkedIn enrichment already done for the same `linkedinUrl` / `linkedinUrlSalesNav`, or email already having a deliverability status.\n\nDoes **not** bypass:\n- **Enrichment currently in progress** — if another enrichment is already running for this contact, the request is still skipped (no parallel enrichments, no double billing).\n- **Previously returned not-found** — for `findEmail` and `findPhone`, if a prior enrichment with the same inputs (`linkedinUrl`, `linkedinUrlSalesNav`, first / last name, company name / domain / LinkedIn URL) already returned not-found, the request is still skipped. Changing any of those inputs on the lead lifts the block without needing `force`.",
            "example": "true",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Enrichment ID"
                    }
                  }
                },
                "example": {
                  "id": "enr_Ohbs0mEsWmDjTnxTi"
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Lead or contact not found",
            "content": {
              "application/json": {
                "examples": {
                  "leadNotFound": {
                    "summary": "Lead does not exist",
                    "value": {
                      "error": "Lead not found",
                      "code": "LEAD_NOT_FOUND"
                    }
                  },
                  "contactNotFound": {
                    "summary": "Lead exists but its underlying contact is missing",
                    "value": {
                      "error": "Contact not found for this lead",
                      "code": "CONTACT_NOT_FOUND"
                    }
                  }
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          },
          "409": {
            "description": "Enrichment cannot proceed because of the current state of the lead/contact",
            "content": {
              "application/json": {
                "examples": {
                  "alreadyEnriched": {
                    "summary": "Contact already has the requested data — retry with ?force=true to override",
                    "value": {
                      "error": "Enrichment skipped: contact already has the requested data or was recently enriched",
                      "code": "ALREADY_ENRICHED"
                    }
                  },
                  "inProgress": {
                    "summary": "An enrichment is already running for this lead — wait for it to complete",
                    "value": {
                      "error": "lead is already being enriched"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Enrichment failed",
            "content": {
              "application/json": {
                "example": {
                  "error": "Failed to enrich lead"
                }
              }
            }
          }
        }
      }
    },
    "/watchlist/signals": {
      "get": {
        "summary": "Get Signal Agent signals",
        "tags": [
          "Signal Agents"
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number to retrieve (cannot be used with offset)",
            "example": "1",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Number of records to skip (cannot be used with page)",
            "example": "0",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Number of signals to retrieve. Maximum value: 100",
            "example": "50",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "required": false,
            "description": "The field by which to sort signals",
            "example": "receivedAt",
            "schema": {
              "type": "string",
              "enum": [
                "receivedAt",
                "createdAt"
              ]
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "required": false,
            "description": "The sort direction",
            "example": "desc",
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "Filter by signal type(s). Can be a single value or array using type[] notation. Valid values from WATCH_LIST_SIGNAL_CONFIGURATIONS_TYPES_STANDARD_KEYS",
            "example": "jobChange",
            "schema": {
              "oneOf": [
                {
                  "type": "string"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Filter by signal status(es). Can be a single value or array using status[] notation. Valid values from WATCH_LIST_SIGNAL_COMPUTED_STATUSES",
            "example": "new",
            "schema": {
              "oneOf": [
                {
                  "type": "string"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              ]
            }
          },
          {
            "name": "receivedAtFrom",
            "in": "query",
            "required": false,
            "description": "Filter signals received on or after this date (ISO date string)",
            "example": "2024-01-01T00:00:00.000Z",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "receivedAtTo",
            "in": "query",
            "required": false,
            "description": "Filter signals received on or before this date (ISO date string). Must be greater than receivedAtFrom if both are provided",
            "example": "2024-12-31T23:59:59.999Z",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "watchListId",
            "in": "query",
            "required": false,
            "description": "Filter signals by specific Signal Agent ID",
            "example": "wl_abc123",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WatchListApiFetchSignalsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation error - invalid query parameters, pagination conflict, or invalid date range",
            "content": {
              "text/plain": {
                "examples": {
                  "invalidPagination": {
                    "value": "page must be a positive integer"
                  },
                  "paginationConflict": {
                    "value": "Cannot use both page and offset parameters"
                  },
                  "invalidLimit": {
                    "value": "limit must be between 1 and 100"
                  },
                  "invalidSort": {
                    "value": "sortBy must be either receivedAt or createdAt"
                  },
                  "invalidType": {
                    "value": "Invalid type values: invalid_type"
                  },
                  "invalidStatus": {
                    "value": "Invalid status values: invalid_status"
                  },
                  "invalidDate": {
                    "value": "receivedAtFrom must be a valid ISO date string"
                  },
                  "invalidDateRange": {
                    "value": "receivedAtFrom must be before receivedAtTo"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - invalid or missing API key",
            "content": {
              "text/plain": {
                "example": "Unauthorized"
              }
            }
          },
          "404": {
            "description": "Watchlist not found",
            "content": {
              "text/plain": {
                "example": "Watchlist not found"
              }
            }
          },
          "405": {
            "description": "Method not allowed - only GET is supported",
            "content": {
              "text/plain": {
                "example": "Method not allowed"
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "text/plain": {
                "example": "Internal server error"
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/user/email-accounts": {
      "post": {
        "summary": "Connect Email Account",
        "tags": [
          "Email Accounts"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "sender_name",
                  "sender_email",
                  "smtp_host",
                  "smtp_port",
                  "smtp_login",
                  "smtp_password",
                  "imap_host",
                  "imap_port",
                  "imap_login",
                  "imap_password"
                ],
                "properties": {
                  "sender_name": {
                    "type": "string",
                    "description": "Display name for the sender.",
                    "example": "John Doe"
                  },
                  "sender_email": {
                    "type": "string",
                    "format": "email",
                    "description": "Email address used as the sender.",
                    "example": "john@company.com"
                  },
                  "smtp_host": {
                    "type": "string",
                    "description": "SMTP server hostname.",
                    "example": "smtp.company.com"
                  },
                  "smtp_port": {
                    "type": "integer",
                    "description": "SMTP server port.",
                    "example": 587
                  },
                  "smtp_login": {
                    "type": "string",
                    "description": "SMTP authentication login.",
                    "example": "john@company.com"
                  },
                  "smtp_password": {
                    "type": "string",
                    "description": "SMTP authentication password.",
                    "example": "password123"
                  },
                  "smtp_secure": {
                    "type": "boolean",
                    "description": "Use SSL/TLS for SMTP connection.",
                    "default": false
                  },
                  "imap_host": {
                    "type": "string",
                    "description": "IMAP server hostname.",
                    "example": "imap.company.com"
                  },
                  "imap_port": {
                    "type": "integer",
                    "description": "IMAP server port.",
                    "example": 993
                  },
                  "imap_login": {
                    "type": "string",
                    "description": "IMAP authentication login.",
                    "example": "john@company.com"
                  },
                  "imap_password": {
                    "type": "string",
                    "description": "IMAP authentication password.",
                    "example": "password123"
                  },
                  "imap_secure": {
                    "type": "boolean",
                    "description": "Use SSL/TLS for IMAP connection.",
                    "default": false
                  },
                  "userId": {
                    "type": "string",
                    "description": "Assign the email account to a specific team member. Must be a member of the team. Defaults to the API key creator or team owner."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Email account connected successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Unique identifier of the created email account."
                    },
                    "email": {
                      "type": "string",
                      "format": "email",
                      "description": "The sender email address."
                    },
                    "provider": {
                      "type": "string",
                      "description": "Always `custom` for SMTP/IMAP accounts.",
                      "example": "custom"
                    }
                  }
                },
                "example": {
                  "id": "umx_A1B2C3D4E5F6G7H8I9",
                  "email": "john@company.com",
                  "provider": "custom"
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / Missing required fields / Invalid host / This SMTP mailbox already exists",
            "content": {
              "text/plain": {
                "example": "Missing required fields"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "403": {
            "description": "User is not a member of this team",
            "content": {
              "text/plain": {
                "example": "User is not a member of this team"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/user/email-accounts/{emailAccountId}": {
      "delete": {
        "summary": "Disconnect Email Account",
        "tags": [
          "Email Accounts"
        ],
        "parameters": [
          {
            "name": "emailAccountId",
            "in": "path",
            "required": true,
            "description": "The ID of the email account to disconnect.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Email account disconnected successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "403": {
            "description": "You are not allowed to modify this mailbox",
            "content": {
              "text/plain": {
                "example": "You are not allowed to modify this mailbox"
              }
            }
          },
          "404": {
            "description": "Email account not found",
            "content": {
              "text/plain": {
                "example": "Email account not found"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/user/email-accounts/{emailAccountId}/test": {
      "post": {
        "summary": "Test Email Account",
        "tags": [
          "Email Accounts"
        ],
        "parameters": [
          {
            "name": "emailAccountId",
            "in": "path",
            "required": true,
            "description": "The ID of the email account to test.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Test results for SMTP and IMAP connections",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "smtp": {
                      "type": "object",
                      "properties": {
                        "success": {
                          "type": "boolean",
                          "description": "Whether the SMTP connection test passed."
                        },
                        "error": {
                          "type": "string",
                          "description": "Error message if the test failed."
                        }
                      }
                    },
                    "imap": {
                      "type": "object",
                      "properties": {
                        "success": {
                          "type": "boolean",
                          "description": "Whether the IMAP connection test passed."
                        },
                        "error": {
                          "type": "string",
                          "description": "Error message if the test failed."
                        }
                      }
                    }
                  }
                },
                "example": {
                  "smtp": {
                    "success": true
                  },
                  "imap": {
                    "success": true
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "The authentication you supplied is incorrect",
            "content": {
              "text/plain": {
                "example": "The authentication you supplied is incorrect"
              }
            }
          },
          "404": {
            "description": "Email account not found",
            "content": {
              "text/plain": {
                "example": "Email account not found"
              }
            }
          },
          "405": {
            "description": "Method not allowed"
          }
        }
      }
    },
    "/user/channels": {
      "get": {
        "summary": "Get User Channels",
        "tags": [
          "Users"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Connected channels and feature availability for the authenticated user",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "plan": {
                      "type": "string",
                      "nullable": true,
                      "description": "Current billing plan name"
                    },
                    "email": {
                      "type": "object",
                      "properties": {
                        "connected": {
                          "type": "boolean",
                          "description": "Whether at least one email account is connected"
                        },
                        "available": {
                          "type": "boolean",
                          "description": "Whether the email channel is available on the current plan"
                        },
                        "accounts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Mailbox identifier"
                              },
                              "email": {
                                "type": "string",
                                "description": "Email address"
                              },
                              "provider": {
                                "type": "string",
                                "enum": [
                                  "google",
                                  "microsoft",
                                  "custom"
                                ],
                                "description": "Email provider"
                              }
                            }
                          }
                        }
                      }
                    },
                    "linkedin": {
                      "type": "object",
                      "properties": {
                        "connected": {
                          "type": "boolean",
                          "description": "Whether LinkedIn is connected"
                        },
                        "available": {
                          "type": "boolean",
                          "description": "Whether LinkedIn is available on the current plan"
                        }
                      }
                    },
                    "whatsapp": {
                      "type": "object",
                      "properties": {
                        "connected": {
                          "type": "boolean",
                          "description": "Whether at least one WhatsApp account is connected"
                        },
                        "available": {
                          "type": "boolean",
                          "description": "Whether WhatsApp is available on the current plan"
                        },
                        "addonActive": {
                          "type": "boolean",
                          "description": "Whether the WhatsApp addon is active"
                        },
                        "accounts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "WhatsApp account identifier"
                              },
                              "phoneNumber": {
                                "type": "string",
                                "description": "Phone number"
                              },
                              "label": {
                                "type": "string",
                                "description": "Account label"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "plan": "Multichannel Expert",
                  "email": {
                    "connected": true,
                    "available": true,
                    "accounts": [
                      {
                        "id": "usm_2mkqJNUjnJQiyVBht",
                        "email": "john@acme.com",
                        "provider": "google"
                      }
                    ]
                  },
                  "linkedin": {
                    "connected": true,
                    "available": true
                  },
                  "whatsapp": {
                    "connected": false,
                    "available": true,
                    "addonActive": false,
                    "accounts": []
                  }
                }
              }
            }
          },
          "400": {
            "description": "Possible errors: Bad team / No user found for this api key",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "405": {
            "description": "Only GET method is supported",
            "content": {
              "text/plain": {
                "example": "Bad method"
              }
            }
          }
        }
      }
    },
    "/campaigns/{campaignId}/duplicate": {
      "parameters": [
        {
          "name": "campaignId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the campaign to duplicate",
          "example": "cam_A1B2C3D4E5F6G7H8I9",
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "summary": "Duplicate Campaign",
        "tags": [
          "Campaigns"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Custom name for the duplicated campaign. If not provided, the original name with ' Copy' suffix is used."
                  }
                }
              },
              "example": {
                "name": "My duplicated campaign"
              }
            }
          }
        },
        "responses": {
          "200": {
            "headers": {
              "Content-Type": {
                "schema": {
                  "type": "string"
                },
                "example": "application/json"
              }
            },
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "_id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "sequenceId": {
                      "type": "string"
                    },
                    "archived": {
                      "type": "boolean"
                    },
                    "labels": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "createdBy": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "senders": {
                      "type": "array",
                      "items": {}
                    },
                    "hasError": {
                      "type": "boolean"
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                },
                "example": {
                  "_id": "cam_X1Y2Z3A4B5C6D7E8F9",
                  "name": "My duplicated campaign",
                  "sequenceId": "seq_A1B2C3D4E5F6G7H8I9",
                  "labels": [],
                  "createdAt": "2024-01-15T10:30:00.000Z",
                  "createdBy": "usr_A1B2C3D4E5F6G7H8I9",
                  "status": "draft",
                  "senders": []
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "Bad team"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Campaign not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "Campaign not found"
                }
              }
            }
          }
        }
      }
    },
    "/fields": {
      "get": {
        "summary": "List Fields",
        "tags": [
          "Fields"
        ],
        "parameters": [
          {
            "name": "entity",
            "in": "query",
            "required": false,
            "description": "Filter by entity type",
            "schema": {
              "type": "string",
              "enum": [
                "contact",
                "company"
              ]
            }
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "description": "Filter by field source",
            "schema": {
              "type": "string",
              "enum": [
                "default",
                "custom",
                "crm_synced"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "contact": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string",
                                "description": "Internal field name (use this as the key when upserting contacts/companies)"
                              },
                              "label": {
                                "type": "string",
                                "description": "Human-readable display name"
                              },
                              "type": {
                                "type": "string",
                                "enum": [
                                  "text",
                                  "number",
                                  "boolean",
                                  "datetime",
                                  "date",
                                  "phone"
                                ],
                                "description": "Field data type"
                              },
                              "source": {
                                "type": "string",
                                "enum": [
                                  "default",
                                  "custom",
                                  "crm_synced"
                                ],
                                "description": "Origin of the field"
                              },
                              "crmField": {
                                "type": "string",
                                "description": "Corresponding CRM field name (crm_synced fields only)"
                              }
                            },
                            "required": [
                              "name",
                              "label",
                              "type",
                              "source"
                            ]
                          }
                        },
                        "company": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string",
                                "description": "Internal field name (use this as the key when upserting contacts/companies)"
                              },
                              "label": {
                                "type": "string",
                                "description": "Human-readable display name"
                              },
                              "type": {
                                "type": "string",
                                "enum": [
                                  "text",
                                  "number",
                                  "boolean",
                                  "datetime",
                                  "date",
                                  "phone"
                                ],
                                "description": "Field data type"
                              },
                              "source": {
                                "type": "string",
                                "enum": [
                                  "default",
                                  "custom",
                                  "crm_synced"
                                ],
                                "description": "Origin of the field"
                              },
                              "crmField": {
                                "type": "string",
                                "description": "Corresponding CRM field name (crm_synced fields only)"
                              }
                            },
                            "required": [
                              "name",
                              "label",
                              "type",
                              "source"
                            ]
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "contact": [
                      {
                        "name": "email",
                        "label": "Email",
                        "type": "text",
                        "source": "default"
                      },
                      {
                        "name": "firstName",
                        "label": "First name",
                        "type": "text",
                        "source": "default"
                      },
                      {
                        "name": "revenue",
                        "label": "Annual Revenue",
                        "type": "number",
                        "source": "custom"
                      },
                      {
                        "name": "leadStatus",
                        "label": "leadStatus",
                        "type": "text",
                        "source": "crm_synced",
                        "crmField": "hs_lead_status"
                      }
                    ],
                    "company": [
                      {
                        "name": "linkedinUrl",
                        "label": "LinkedIn URL",
                        "type": "text",
                        "source": "default"
                      },
                      {
                        "name": "industry",
                        "label": "Industry",
                        "type": "text",
                        "source": "custom"
                      }
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "success": false,
                  "error": "Invalid entity parameter. Must be one of: contact, company"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "Unauthorized"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "success": false,
                  "error": "Method not allowed. Use GET."
                }
              }
            }
          }
        }
      }
    },
    "/campaigns/{campaignId}/statutes": {
      "parameters": [
        {
          "name": "campaignId",
          "in": "path",
          "required": true,
          "description": "The unique identifier of the campaign",
          "example": "cam_A1B2C3D4E5F6G7H8I9",
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "summary": "Get Campaign Statutes",
        "description": "Retrieves validation statutes for a campaign, including errors that block launching and warnings about daily limits, DNS issues, etc. Uses the same validation engine as the lemlist UI.",
        "tags": [
          "Campaigns"
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "description": "The campaign name"
                    },
                    "status": {
                      "type": "string",
                      "description": "The campaign status (draft, running, paused, etc.)"
                    },
                    "statutes": {
                      "type": "array",
                      "description": "List of validation statutes for the campaign",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "issue",
                              "information"
                            ],
                            "description": "Statute type: 'issue' for problems, 'information' for non-blocking info"
                          },
                          "level": {
                            "type": "integer",
                            "enum": [
                              1,
                              2,
                              3
                            ],
                            "description": "Severity: 3 = error (blocks launch), 2 = warning (actionable), 1 = info"
                          },
                          "message": {
                            "type": "string",
                            "description": "Human-readable description of the issue (may contain HTML)"
                          },
                          "category": {
                            "type": "string",
                            "description": "Optional category (e.g. 'limit', 'steps', 'schedule')"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "name": "Product Launch Campaign",
                  "status": "draft",
                  "statutes": [
                    {
                      "type": "issue",
                      "level": 3,
                      "message": "No senders configured on this campaign."
                    },
                    {
                      "type": "information",
                      "level": 2,
                      "category": "limit",
                      "message": "John Doe daily email sending limit has been exceeded. You can increase the limit in settings or wait 2 hours"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad team",
            "content": {
              "text/plain": {
                "example": "Bad team"
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Campaign not found"
          },
          "405": {
            "description": "Bad method"
          }
        }
      }
    }
  }
}
