For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
HomepageProduct HelpLog inTry for Free
Developers HomeAPI ReferenceMCP
Developers HomeAPI ReferenceMCP
  • Getting Started
    • Introduction
    • Authentication with API Keys
    • Authentication with OAuth
    • API Clients
    • Pagination
    • Specifying Fields
    • Filter Parameters
    • HTTP Response Codes
    • Rate Limits
    • Timezone Offsets
    • Rich Text Fields
    • Changelog
  • CRM Core
    • Leads
    • Contacts
    • Opportunities
    • Tasks
    • Files
    • Custom Objects
    • Comments
  • Activities
    • Activities
    • Notes
    • Calls
    • Emails
    • Email Threads
    • WhatsApp Messages
    • Meetings
    • Custom Activities
    • Creations
    • Form Submissions
    • Lead Status Changes
    • Opportunity Status Changes
    • Lead Merges
    • Task Completions
  • Events & Webhooks
    • Webhooks
    • Events
  • Search & Reporting
    • Advanced Filtering
    • Smart Views
    • Reporting
  • Automation & Bulk Actions
    • Sequences (Workflows)
    • Bulk Actions
    • Exports
      • GETList all the exports
      • POSTExport leads based on a search query
      • POSTExport opportunities, based on opportunity filters
      • GETGet a single Export
    • AI Field Enrichment
  • CRM Configuration
    • Custom Fields
    • Custom Activity Types
    • Custom Object Types
    • Pipelines
    • Opportunity Statuses
    • Lead Statuses
    • Integration Links
    • Forms
  • Communication Configuration
    • Email Templates
    • SMS Templates
    • Outcomes
    • Playbooks
    • Scheduling Links Guide
    • Scheduling Links
    • Connected Accounts
    • Send As
    • Unsubscribed Emails
    • Phone Numbers
    • Blocked Phone Numbers
    • Dialers
  • Users & Organizations
    • Users
    • Organizations
    • Memberships
    • Roles
    • Groups
Close

Product

OverviewCommunicationAutomationIntegrationsReportingSMSCallingSecurityForms

Pricing & Use Cases

PricingClose vs Other CRMsCustomer Stories

Resources

Sales BlogSales ResourcesSales GuidesWebinarsOn-Demand DemoSales Tools

Company

AboutCareersPartner with CloseBrand GuidelinesTermsPrivacyGDPRCCPA

Get Help

+1-833-GO-CLOSEHelp CenterDownload the Close AppProduct UpdatesSystem Status
LogoLogo
HomepageProduct HelpLog inTry for Free
Automation & Bulk ActionsExports

Export leads based on a search query

||View as Markdown|
POST
https://api.close.com/api/v1/export/lead/
POST
/api/v1/export/lead/
$curl -X POST https://api.close.com/api/v1/export/lead/ \
> -H "Content-Type: application/json" \
> -u "<CLOSE_API_KEY>:" \
> -d '{
> "date_format": "iso8601",
> "format": "csv",
> "results_limit": null,
> "s_query": {
> "queries": [
> {
> "object_type": "lead",
> "type": "object_type"
> },
> {
> "condition": {
> "mode": "full_words",
> "type": "text",
> "value": "ACME Inc."
> },
> "field": {
> "field_name": "name",
> "object_type": "lead",
> "type": "regular_field"
> },
> "type": "field_condition"
> }
> ],
> "type": "and"
> },
> "send_done_email": false,
> "sort": [
> {
> "direction": "desc",
> "field": {
> "field_name": "date_created",
> "object_type": "lead",
> "type": "regular_field"
> }
> }
> ],
> "type": "leads"
>}'
1{
2 "created_by": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA",
3 "date_created": "2014-04-02T15:00:05.190000+00:00",
4 "date_format": "iso8601",
5 "date_updated": "2014-04-02T23:36:30.719000+00:00",
6 "download_url": null,
7 "fields": [
8 "addresses",
9 "contacts",
10 "created_by",
11 "created_by_name",
12 "custom",
13 "date_created",
14 "date_updated",
15 "description",
16 "display_name",
17 "id",
18 "name",
19 "status_id",
20 "status_label",
21 "updated_by",
22 "updated_by_name",
23 "url"
24 ],
25 "format": "csv",
26 "id": "expo_yasdalskdjjflkahxrvLG8iVupzjoJVRPgrGhJ0A0b3bae",
27 "n_docs": null,
28 "n_docs_processed": 0,
29 "organization_id": "orga_alksdjdfjasdfkljasdlkfjfaklsdjf",
30 "results_limit": null,
31 "s_query": {
32 "queries": [
33 {
34 "object_type": "lead",
35 "type": "object_type"
36 },
37 {
38 "condition": {
39 "mode": "full_words",
40 "type": "text",
41 "value": "ACME Inc."
42 },
43 "field": {
44 "field_name": "name",
45 "object_type": "lead",
46 "type": "regular_field"
47 },
48 "type": "field_condition"
49 }
50 ],
51 "type": "and"
52 },
53 "send_done_email": false,
54 "sort": [
55 {
56 "direction": "desc",
57 "field": {
58 "field_name": "date_created",
59 "object_type": "lead",
60 "type": "regular_field"
61 }
62 }
63 ],
64 "status": "created",
65 "type": "leads",
66 "updated_by": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA"
67}
You will receive a link to the generated file via email once the export is done. The exported file is GZIP compressed to make your download and our upload faster. The `content-encoding` HTTP header will be set to `gzip` and the `content-type` HTTP header will be set to `text/csv` for CSV exports or `application/json` for JSON exports. Parameters: - `s_query/results_limit/sort` (optional) - The [Advanced Filtering API](https://developer.close.com/api/resources/advanced-filtering) parameters used to narrow the exported results down. By default, all leads are exported. - `format` - Format of the exported file. The choices are: `csv`, `json`. JSON is recommended for raw backups or data migrations. - `type` - Type of the export. - `leads` - For CSV exports, it results in one row per lead. For JSON exports, this is the recommended type and is a superset of the other two types. - `contacts` - For CSV exports, it results in one row per contact. - `lead_opps` - For CSV exports, it results in one row per opportunity. - `date_format` (optional) - Controls the format of date objects. Note: this only works with the `csv` format. - `original` (default) - A date format that includes microseconds and timezone information. - Date: `[YYYY]-[MM]-[DD]` - Date w/ time: `[YYYY]-[MM]-[DD] [hh]:[mm]:[ss.sssss]±[hh]:[mm]` - `iso8601` (recommended) - An [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) compatible date representation that does not include microseconds. - Date: `[YYYY]-[MM]-[DD]` - Date w/ time: `[YYYY]-[MM]-[DD]T[hh]:[mm]:[ss]±[hh]:[mm]` - `excel` - An Excel compatible date format. Dates are always in UTC, do not include timezone information or microseconds, and use a 12 hour clock with an AM or PM designation. - Date: `[YYYY]-[MM]-[DD]` - Date w/ time: `[YYYY]-[MM]-[DD] [hh]:[mm]:[ss] [AM|PM]` - `fields` (optional) - By default we return all the data fields in each export type. If you only need specific fields exported, you can explicitly list them in `fields` to get smaller exports. - `include_activities` (optional) - Activities aren't included in any exports by default. If you want all your Activities exported as well, pass `"include_activities": true`. Note: this only works for `leads` type with `json` format. - `include_smart_fields` (optional) - Smart Fields aren't included in any exports by default. If you want all of them exported as well, pass `"include_smart_fields": true`. Note: this only works for `leads` type with `json` format or any type formatted as `csv`. Smart fields are calculated fields, like number of emails on a lead. - `send_done_email` - Set to `false` if you don't want to get a confirmation email after the bulk action is done.
Was this page helpful?
Previous

List all the exports

Next

Export opportunities, based on opportunity filters

Built with

You will receive a link to the generated file via email once the export is done.

The exported file is GZIP compressed to make your download and our upload faster. The content-encoding HTTP header will be set to gzip and the content-type HTTP header will be set to text/csv for CSV exports or application/json for JSON exports.

Parameters:

  • s_query/results_limit/sort (optional) - The Advanced Filtering API parameters used to narrow the exported results down. By default, all leads are exported.
  • format - Format of the exported file. The choices are: csv, json. JSON is recommended for raw backups or data migrations.
  • type - Type of the export.
    • leads - For CSV exports, it results in one row per lead. For JSON exports, this is the recommended type and is a superset of the other two types.
    • contacts - For CSV exports, it results in one row per contact.
    • lead_opps - For CSV exports, it results in one row per opportunity.
  • date_format (optional) - Controls the format of date objects. Note: this only works with the csv format.
    • original (default) - A date format that includes microseconds and timezone information.
      • Date: [YYYY]-[MM]-[DD]
      • Date w/ time: [YYYY]-[MM]-[DD] [hh]:[mm]:[ss.sssss]±[hh]:[mm]
    • iso8601 (recommended) - An ISO 8601 compatible date representation that does not include microseconds.
      • Date: [YYYY]-[MM]-[DD]
      • Date w/ time: [YYYY]-[MM]-[DD]T[hh]:[mm]:[ss]±[hh]:[mm]
    • excel - An Excel compatible date format. Dates are always in UTC, do not include timezone information or microseconds, and use a 12 hour clock with an AM or PM designation.
      • Date: [YYYY]-[MM]-[DD]
      • Date w/ time: [YYYY]-[MM]-[DD] [hh]:[mm]:[ss] [AM|PM]
  • fields (optional) - By default we return all the data fields in each export type. If you only need specific fields exported, you can explicitly list them in fields to get smaller exports.
  • include_activities (optional) - Activities aren’t included in any exports by default. If you want all your Activities exported as well, pass "include_activities": true. Note: this only works for leads type with json format.
  • include_smart_fields (optional) - Smart Fields aren’t included in any exports by default. If you want all of them exported as well, pass "include_smart_fields": true. Note: this only works for leads type with json format or any type formatted as csv. Smart fields are calculated fields, like number of emails on a lead.
  • send_done_email - Set to false if you don’t want to get a confirmation email after the bulk action is done.

Authentication

AuthorizationBasic
Use your API key as the username and leave the password empty.
OR
AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Request

This endpoint expects any.

Response

Successful response

Errors

400
Bad Request Error
401
Unauthorized Error
404
Not Found Error