{
  "openapi": "3.1.0",
  "info": {
    "title": "SalesMix API",
    "version": "1.0.0",
    "description": "REST API for LinkedIn outreach automation: senders, sequences, leads, conversations, approvals, webhooks and analytics. Every feature of the SalesMix app is available here.",
    "contact": {
      "email": "hello@salesmix.com",
      "url": "https://salesmix.com/api"
    }
  },
  "externalDocs": {
    "url": "https://salesmix.com/api",
    "description": "SalesMix API overview"
  },
  "servers": [
    {
      "url": "https://api.salesmix.com/v1"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "tags": [
    {
      "name": "Accounts"
    },
    {
      "name": "Sequences"
    },
    {
      "name": "Leads"
    },
    {
      "name": "Conversations"
    },
    {
      "name": "Approvals"
    },
    {
      "name": "Webhooks"
    },
    {
      "name": "Analytics"
    }
  ],
  "paths": {
    "/accounts": {
      "get": {
        "tags": [
          "Accounts"
        ],
        "summary": "List connected LinkedIn senders and their limits",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "maximum": 100,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Account"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/accounts/{id}": {
      "patch": {
        "tags": [
          "Accounts"
        ],
        "summary": "Update daily limits, working hours and warm-up",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Account"
                }
              }
            }
          }
        }
      }
    },
    "/sequences": {
      "get": {
        "tags": [
          "Sequences"
        ],
        "summary": "List sequences",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "maximum": 100,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Sequence"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Sequences"
        ],
        "summary": "Create a sequence from JSON steps",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "description": "Repeated requests with the same key return the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SequenceCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Sequence"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{id}": {
      "get": {
        "tags": [
          "Sequences"
        ],
        "summary": "Fetch a sequence, its steps and stats",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Sequence"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{id}/launch": {
      "post": {
        "tags": [
          "Sequences"
        ],
        "summary": "Start or resume sending",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Sequence"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{id}/pause": {
      "post": {
        "tags": [
          "Sequences"
        ],
        "summary": "Pause without losing progress",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Sequence"
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{id}/leads": {
      "post": {
        "tags": [
          "Leads"
        ],
        "summary": "Enroll up to 1,000 leads per call",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "description": "Repeated requests with the same key return the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "leads"
                ],
                "properties": {
                  "leads": {
                    "type": "array",
                    "maxItems": 1000,
                    "items": {
                      "$ref": "#/components/schemas/LeadInput"
                    }
                  },
                  "start": {
                    "type": "string",
                    "enum": [
                      "now",
                      "scheduled"
                    ],
                    "default": "now"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "enrolled": {
                      "type": "integer"
                    },
                    "skipped_duplicates": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/sequences/{id}/leads/{lead_id}": {
      "delete": {
        "tags": [
          "Leads"
        ],
        "summary": "Remove a lead from a sequence",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lead_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Removed"
          }
        }
      }
    },
    "/leads": {
      "get": {
        "tags": [
          "Leads"
        ],
        "summary": "Filter leads by status, sequence, sender or intent",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "enrolled",
                "invited",
                "connected",
                "replied",
                "completed"
              ]
            }
          },
          {
            "name": "intent",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/Intent"
            }
          },
          {
            "name": "sequence_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Lead"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/conversations": {
      "get": {
        "tags": [
          "Conversations"
        ],
        "summary": "Unified inbox across every sender",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "intent",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/Intent"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Conversation"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/conversations/{id}/reply": {
      "post": {
        "tags": [
          "Conversations"
        ],
        "summary": "Reply as the original sender",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "description": "Repeated requests with the same key return the original result."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "text"
                ],
                "properties": {
                  "text": {
                    "type": "string"
                  },
                  "require_approval": {
                    "type": "boolean",
                    "default": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Queued",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Message"
                }
              }
            }
          }
        }
      }
    },
    "/approvals": {
      "post": {
        "tags": [
          "Approvals"
        ],
        "summary": "Queue a draft for human review",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "lead_id",
                  "text"
                ],
                "properties": {
                  "lead_id": {
                    "type": "string"
                  },
                  "text": {
                    "type": "string"
                  },
                  "step": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Approval"
                }
              }
            }
          }
        }
      }
    },
    "/approvals/{id}/approve": {
      "post": {
        "tags": [
          "Approvals"
        ],
        "summary": "Approve a draft, optionally with edits",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Approval"
                }
              }
            }
          }
        }
      }
    },
    "/webhooks": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Subscribe a URL to events",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url",
                  "events"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/EventType"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "secret": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/analytics/funnel": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Funnel by sequence, sender or step",
        "parameters": [
          {
            "name": "group_by",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "sequence",
                "sender",
                "step"
              ]
            }
          },
          {
            "name": "period",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "30d"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "enrolled": {
                      "type": "integer"
                    },
                    "invited": {
                      "type": "integer"
                    },
                    "accepted": {
                      "type": "integer"
                    },
                    "replied": {
                      "type": "integer"
                    },
                    "interested": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "Workspace API key from Settings → API keys"
      }
    },
    "schemas": {
      "Intent": {
        "type": "string",
        "enum": [
          "interested",
          "meeting",
          "not_now",
          "not_a_fit",
          "unknown"
        ]
      },
      "EventType": {
        "type": "string",
        "enum": [
          "lead.enrolled",
          "connection.sent",
          "connection.accepted",
          "message.sent",
          "message.replied",
          "lead.intent_changed",
          "email.handoff",
          "approval.requested",
          "sequence.completed",
          "account.limit_reached"
        ]
      },
      "Account": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "premium",
              "sales_navigator"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "warming_up",
              "paused"
            ]
          },
          "limits": {
            "$ref": "#/components/schemas/AccountUpdate"
          }
        }
      },
      "AccountUpdate": {
        "type": "object",
        "properties": {
          "daily_invites": {
            "type": "integer"
          },
          "daily_messages": {
            "type": "integer"
          },
          "daily_inmails": {
            "type": "integer"
          },
          "daily_profile_visits": {
            "type": "integer"
          },
          "working_hours": {
            "type": "string",
            "example": "09:00-17:30"
          },
          "timezone": {
            "type": "string"
          },
          "warm_up": {
            "type": "boolean"
          }
        }
      },
      "Step": {
        "type": "object",
        "description": "One step. Keys: connect, message, inmail, email, visit_profile, like_post, withdraw, wait, if, end.",
        "additionalProperties": true
      },
      "SequenceCreate": {
        "type": "object",
        "required": [
          "name",
          "steps"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "dynamic",
              "new_connections",
              "existing_contacts",
              "open_inmails"
            ]
          },
          "senders": {
            "type": "string",
            "example": "rotate:all"
          },
          "steps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Step"
            }
          }
        }
      },
      "Sequence": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "running",
              "paused"
            ]
          },
          "steps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Step"
            }
          },
          "stats": {
            "type": "object",
            "additionalProperties": {
              "type": "number"
            }
          }
        }
      },
      "LeadInput": {
        "type": "object",
        "required": [
          "linkedin_url"
        ],
        "properties": {
          "linkedin_url": {
            "type": "string",
            "format": "uri"
          },
          "first_name": {
            "type": "string"
          },
          "last_name": {
            "type": "string"
          },
          "company": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "custom": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      },
      "Lead": {
        "allOf": [
          {
            "$ref": "#/components/schemas/LeadInput"
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "intent": {
                "$ref": "#/components/schemas/Intent"
              },
              "sequence_id": {
                "type": "string"
              },
              "sender_id": {
                "type": "string"
              }
            }
          }
        ]
      },
      "Message": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "direction": {
            "type": "string",
            "enum": [
              "inbound",
              "outbound"
            ]
          },
          "text": {
            "type": "string"
          },
          "sent_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Conversation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "lead": {
            "$ref": "#/components/schemas/Lead"
          },
          "sender_id": {
            "type": "string"
          },
          "intent": {
            "$ref": "#/components/schemas/Intent"
          },
          "last_message": {
            "$ref": "#/components/schemas/Message"
          }
        }
      },
      "Approval": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "lead_id": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "approved",
              "skipped"
            ]
          },
          "source": {
            "type": "string",
            "description": "Agent or API key that wrote the draft"
          }
        }
      }
    }
  }
}