> ## Documentation Index
> Fetch the complete documentation index at: https://bavlio.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Import leads into a campaign

> Starts importing a CSV of your own leads into the campaign with the column mapping you confirm, and answers 201 with the import while it runs. A lead costs no credits when the file already holds everything the sequence needs, and one credit when Bavlio fills a needed field in; rows without a name, without what the sequence needs, already in the campaign, opted out or beyond your credits are skipped and counted. Needs a plan.

## OpenAPI

```json
{
  "openapi": "3.2.0",
  "info": {
    "title": "Bavlio API",
    "version": "1.0.0"
  },
  "paths": {
    "/campaigns/{id}/imports": {
      "post": {
        "tags": [
          "Lead imports"
        ],
        "operationId": "leadImports.importCampaignLeads",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string",
              "description": "Campaign id."
            },
            "required": true
          }
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Import id."
                    },
                    "file_name": {
                      "type": "string",
                      "description": "The name the import was started with."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "running",
                        "done",
                        "failed"
                      ],
                      "description": "running while rows are left, then done, or failed with the reason in failure."
                    },
                    "rows": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991,
                      "description": "Rows in the file.",
                      "allOf": [
                        {
                          "minimum": 0
                        }
                      ]
                    },
                    "processed": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991,
                      "description": "Rows read so far.",
                      "allOf": [
                        {
                          "minimum": 0
                        }
                      ]
                    },
                    "added": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991,
                      "description": "Leads added to the campaign.",
                      "allOf": [
                        {
                          "minimum": 0
                        }
                      ]
                    },
                    "credits": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991,
                      "description": "Credits charged for the added leads.",
                      "allOf": [
                        {
                          "minimum": 0
                        }
                      ]
                    },
                    "skipped": {
                      "type": "object",
                      "properties": {
                        "no_name": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991,
                          "allOf": [
                            {
                              "minimum": 0
                            }
                          ]
                        },
                        "no_email": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991,
                          "allOf": [
                            {
                              "minimum": 0
                            }
                          ]
                        },
                        "no_linkedin": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991,
                          "allOf": [
                            {
                              "minimum": 0
                            }
                          ]
                        },
                        "missing_details": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991,
                          "allOf": [
                            {
                              "minimum": 0
                            }
                          ]
                        },
                        "opted_out": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991,
                          "allOf": [
                            {
                              "minimum": 0
                            }
                          ]
                        },
                        "already_added": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991,
                          "allOf": [
                            {
                              "minimum": 0
                            }
                          ]
                        },
                        "no_credits": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991,
                          "allOf": [
                            {
                              "minimum": 0
                            }
                          ]
                        }
                      },
                      "required": [
                        "no_name",
                        "no_email",
                        "no_linkedin",
                        "missing_details",
                        "opted_out",
                        "already_added",
                        "no_credits"
                      ],
                      "additionalProperties": false,
                      "description": "Rows left out, counted by reason."
                    },
                    "failure": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Why the import stopped; null unless it failed."
                    },
                    "started_at": {
                      "type": "string",
                      "description": "When the import started (ISO 8601)."
                    },
                    "finished_at": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "When it finished (ISO 8601); null while it runs."
                    }
                  },
                  "required": [
                    "id",
                    "file_name",
                    "status",
                    "rows",
                    "processed",
                    "added",
                    "credits",
                    "skipped",
                    "failure",
                    "started_at",
                    "finished_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "LeadImportInvalid | CampaignIcpIncomplete | RequestInvalidBody",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/LeadImportInvalidEncoded"
                    },
                    {
                      "$ref": "#/components/schemas/CampaignIcpIncompleteEncoded"
                    },
                    {
                      "$ref": "#/components/schemas/RequestInvalidBodyEncoded"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "AuthMissing | AuthInvalid",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/AuthMissingEncoded"
                    },
                    {
                      "$ref": "#/components/schemas/AuthInvalidEncoded"
                    }
                  ]
                }
              }
            }
          },
          "402": {
            "description": "SubscriptionRequired",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionRequiredEncoded"
                }
              }
            }
          },
          "404": {
            "description": "WorkspaceNotFound | CampaignNotFound",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/WorkspaceNotFoundEncoded"
                    },
                    {
                      "$ref": "#/components/schemas/CampaignNotFoundEncoded"
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "CampaignArchived",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CampaignArchivedEncoded"
                }
              }
            }
          },
          "502": {
            "description": "BillingFailed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingFailedEncoded"
                }
              }
            }
          },
          "503": {
            "description": "BillingUnavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingUnavailableEncoded"
                }
              }
            }
          }
        },
        "description": "Starts importing a CSV of your own leads into the campaign with the column mapping you confirm, and answers 201 with the import while it runs. A lead costs no credits when the file already holds everything the sequence needs, and one credit when Bavlio fills a needed field in; rows without a name, without what the sequence needs, already in the campaign, opted out or beyond your credits are skipped and counted. Needs a plan.",
        "summary": "Import leads into a campaign",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "file_name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "description": "Name the import is listed under."
                  },
                  "csv": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 5000000,
                    "description": "The file's contents as CSV text, header row first."
                  },
                  "mapping": {
                    "type": "object",
                    "properties": {
                      "email": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 2000
                      },
                      "linkedin_url": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 2000
                      },
                      "first_name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 2000
                      },
                      "last_name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 2000
                      },
                      "full_name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 2000
                      },
                      "title": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 2000
                      },
                      "company_name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 2000
                      },
                      "company_domain": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 2000
                      }
                    },
                    "additionalProperties": false,
                    "description": "Which column holds each lead field, by header; leave out a field no column holds."
                  },
                  "custom_fields": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2000
                    },
                    "propertyNames": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40,
                      "pattern": "^[a-z][a-z0-9_]*$"
                    },
                    "maxProperties": 20,
                    "description": "Custom fields to keep, as field name to column header; templates use them as {@name|fallback}."
                  }
                },
                "required": [
                  "file_name",
                  "csv",
                  "mapping"
                ],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AuthInvalidEncoded": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": [
              "AuthInvalid"
            ]
          },
          "statusCode": {
            "type": "number",
            "enum": [
              401
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "auth_invalid"
            ]
          },
          "message": {
            "type": "string",
            "enum": [
              "Bearer credential rejected"
            ]
          }
        },
        "required": [
          "_tag",
          "statusCode",
          "code",
          "message"
        ],
        "additionalProperties": false
      },
      "AuthMissingEncoded": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": [
              "AuthMissing"
            ]
          },
          "statusCode": {
            "type": "number",
            "enum": [
              401
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "auth_missing"
            ]
          },
          "message": {
            "type": "string",
            "enum": [
              "Bearer credential required"
            ]
          }
        },
        "required": [
          "_tag",
          "statusCode",
          "code",
          "message"
        ],
        "additionalProperties": false
      },
      "BillingFailedEncoded": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": [
              "BillingFailed"
            ]
          },
          "statusCode": {
            "type": "number",
            "enum": [
              502
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "billing_failed"
            ]
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "_tag",
          "statusCode",
          "code",
          "message"
        ],
        "additionalProperties": false
      },
      "BillingUnavailableEncoded": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": [
              "BillingUnavailable"
            ]
          },
          "statusCode": {
            "type": "number",
            "enum": [
              503
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "billing_unavailable"
            ]
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "_tag",
          "statusCode",
          "code",
          "message"
        ],
        "additionalProperties": false
      },
      "RequestInvalidBodyEncoded": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": [
              "RequestInvalidBody"
            ]
          },
          "statusCode": {
            "type": "number",
            "enum": [
              400
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "invalid_body"
            ]
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "_tag",
          "statusCode",
          "code",
          "message"
        ],
        "additionalProperties": false
      },
      "WorkspaceNotFoundEncoded": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": [
              "WorkspaceNotFound"
            ]
          },
          "statusCode": {
            "type": "number",
            "enum": [
              404
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "workspace_not_found"
            ]
          },
          "message": {
            "type": "string",
            "enum": [
              "No such workspace for this account: save a company profile or pick a workspace you belong to"
            ]
          }
        },
        "required": [
          "_tag",
          "statusCode",
          "code",
          "message"
        ],
        "additionalProperties": false
      },
      "CampaignArchivedEncoded": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": [
              "CampaignArchived"
            ]
          },
          "statusCode": {
            "type": "number",
            "enum": [
              409
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "campaign_archived"
            ]
          },
          "message": {
            "type": "string",
            "enum": [
              "The campaign is archived and takes no more changes"
            ]
          }
        },
        "required": [
          "_tag",
          "statusCode",
          "code",
          "message"
        ],
        "additionalProperties": false
      },
      "CampaignNotFoundEncoded": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": [
              "CampaignNotFound"
            ]
          },
          "statusCode": {
            "type": "number",
            "enum": [
              404
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "campaign_not_found"
            ]
          },
          "message": {
            "type": "string",
            "enum": [
              "No campaign with this id belongs to the workspace"
            ]
          }
        },
        "required": [
          "_tag",
          "statusCode",
          "code",
          "message"
        ],
        "additionalProperties": false
      },
      "SubscriptionRequiredEncoded": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": [
              "SubscriptionRequired"
            ]
          },
          "statusCode": {
            "type": "number",
            "enum": [
              402
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "billing_subscription_required"
            ]
          },
          "message": {
            "type": "string"
          },
          "preview_leads": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "subscribe_method": {
            "type": "string",
            "enum": [
              "POST"
            ]
          },
          "subscribe_path": {
            "type": "string",
            "enum": [
              "/billing/subscriptions"
            ]
          }
        },
        "required": [
          "_tag",
          "statusCode",
          "code",
          "message",
          "preview_leads",
          "subscribe_method",
          "subscribe_path"
        ],
        "additionalProperties": false
      },
      "CampaignIcpIncompleteEncoded": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": [
              "CampaignIcpIncomplete"
            ]
          },
          "statusCode": {
            "type": "number",
            "enum": [
              400
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "campaign_icp_incomplete"
            ]
          },
          "message": {
            "type": "string",
            "enum": [
              "A campaign runs only with at least one job title in its ICP"
            ]
          }
        },
        "required": [
          "_tag",
          "statusCode",
          "code",
          "message"
        ],
        "additionalProperties": false
      },
      "LeadImportInvalidEncoded": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": [
              "LeadImportInvalid"
            ]
          },
          "statusCode": {
            "type": "number",
            "enum": [
              400
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "lead_import_invalid"
            ]
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "_tag",
          "statusCode",
          "code",
          "message"
        ],
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "bearer": {
        "description": "Send `Authorization: Bearer <token>`. The token is an API key, which starts with `bav_` and comes from creating an API key or starting a registration, or the access token of a Bavlio sign-in.",
        "type": "http",
        "scheme": "Bearer"
      }
    }
  },
  "security": [],
  "tags": [
    {
      "name": "Registration",
      "description": "Open a Bavlio account without signing in. Starting a registration returns an API key for a new ephemeral account, which becomes permanent once its email address is verified."
    },
    {
      "name": "Authentication",
      "description": "Identify the calling account, finish a registration and manage the account's API keys."
    },
    {
      "name": "Account",
      "description": "The account behind your sign-in, and deleting it."
    },
    {
      "name": "Workspaces",
      "description": "A workspace holds the company profile, outreach schedule, team, campaigns and billing Bavlio works with. Calls that act in a workspace use the one whose id is in the bavlio-workspace header, or the account's default workspace when the header is absent."
    },
    {
      "name": "Teams",
      "description": "Manage who belongs to a workspace: its members, their roles and the invitations to join it. Each workspace's plan sets how many team seats it has."
    },
    {
      "name": "Campaigns",
      "description": "A campaign finds leads that match an ideal customer profile (ICP) and buying signals, and reaches out to them through its sequence of LinkedIn and email steps."
    },
    {
      "name": "Lead imports",
      "description": "Bring your own leads: preview a CSV, confirm which column holds what, then import it into a campaign, where the leads go through the same sequence as the ones Bavlio finds."
    },
    {
      "name": "Sequences",
      "description": "A campaign's sequence is the steps Bavlio runs for each lead: profile visits, likes, invites, LinkedIn messages, emails, waits and conditions. Every message and email waits in the review queue for approval before it is sent."
    },
    {
      "name": "Inbox",
      "description": "Conversations with the people your campaigns reached and, for accounts that opt in, your other LinkedIn and email conversations: read them, reply to them and follow changes live."
    },
    {
      "name": "Reviews",
      "description": "Messages and emails go to a lead only after someone approves them. The review queue holds the replies Bavlio drafted for people who answered and the messages and emails it drafted for campaign sequences."
    },
    {
      "name": "Billing",
      "description": "The plans on offer and the workspace's subscription and usage. Plan changes, cancellation and the billing portal need the workspace owner or an admin."
    },
    {
      "name": "LinkedIn",
      "description": "Connect the LinkedIn accounts your campaigns send from, confirm their sign-ins, choose the country LinkedIn sees them from, and disconnect them."
    },
    {
      "name": "Meetings",
      "description": "Meetings booked through the workspace's calendar tool (Google Calendar, Calendly or Cal.com), and the calendar connection that imports them."
    },
    {
      "name": "Email",
      "description": "Connect a Bavimail account, add sending domains and tracking domains, and create the inboxes campaigns send email from."
    }
  ],
  "servers": [
    {
      "url": "https://api.bavlio.com"
    }
  ]
}
```
