# Export leads

Source: https://swapcard.dev/content-api/examples/leads


Retrieve all the leads your booth collected during an event, with the answers to your qualifier questions, to sync them to a CRM or a spreadsheet.

Reference: [`leads` query](../graphql-exhibitor-api-schema/operations/queries/leads.mdx), [`ExhibitorLeads` object](../graphql-exhibitor-api-schema/types/objects/exhibitor-leads.mdx), [`Connection` object](../graphql-exhibitor-api-schema/types/objects/connection.mdx)

## Before you begin

- An exhibitor API key created in the Exhibitor Center, sent in the `Authorization` header to `https://developer.swapcard.com/exhibitor/graphql`. See [Exhibitor authentication](/exhibitors/authentication).
- The `exhibitorId` of your booth and the `eventId` of the event. Get both with [List your booths](graphql-event-api-examples-my-exhibitors.md).

## Export leads
Use this query to fetch the contact leads of a booth. Each lead is a `Connection`: the person you met is in `target`, the user who owns the lead is in `owner`, and the answers to your qualifier questions are in `customFields`.

| Argument | Type | Description |
| --- | --- | --- |
| `eventId` | `ID!` | The ID of the event. Get it with [List your booths](graphql-event-api-examples-my-exhibitors.md). |
| `exhibitorId` | `ID!` | The ID of the exhibitor booth. Get it with [List your booths](graphql-event-api-examples-my-exhibitors.md). |

```graphql title="Query"
query myLeads($eventId: ID!, $exhibitorId: ID!) {
  leads(eventId: $eventId, exhibitorId: $exhibitorId) {
    contacts {
      pageInfo {
        endCursor
        hasNextPage
      }
      nodes {
        id
        connectedAtEvent {
          id
          title
        }
        connectedAt
        isScanned
        rating
        note
        owner {
          ...PersonFragment
        }
        customFields {
          ...FieldsFragment
        }
        target {
          ... on Contact {
            ...PersonFragment
          }
          ... on EventPerson {
            ...EventPersonFragment
          }
        }
      }
    }
  }
}

fragment PersonFragment on PersonInterface {
  id
  email
  firstName
  lastName
  jobTitle
  secondJobTitle
  photoUrl
  organization
  websiteUrl
  biography
  address {
    city
    country
    place
    state
    street
    zipCode
  }
  phoneNumber
  socialNetworks {
    profile
    type
  }
}

fragment EventPersonFragment on EventPerson {
  id
  email
  firstName
  lastName
  jobTitle
  secondJobTitle
  photoUrl
  organization
  websiteUrl
  biography
  address {
    city
    country
    place
    state
    street
    zipCode
  }
  phoneNumbers {
    number
    type
  }
  socialNetworks {
    profile
    type
  }
}

fragment FieldsFragment on FieldUnion {
  __typename

  ... on SelectField {
    id
    value
    definition {
      name
      id
    }
  }
  ... on NumberField {
    id
    numberValue: value
    definition {
      name
    }
  }
  ... on TextField {
    id
    value
    definition {
      name
    }
  }
  ... on UrlField {
    id
    value
    definition {
      name
    }
  }
  ... on MediaField {
    id
    value
    definition {
      name
    }
  }
  ... on LongTextField {
    id
    value
    definition {
      name
    }
  }
  ... on MultipleTextField {
    id
    value
    definition {
      name
    }
  }
  ... on MultipleSelectField {
    id
    value
    definition {
      name
      id
    }
  }

  ... on DateField {
    id
    value
    definition {
      name
    }
  }
}
```

```json title="Variables"
{
  "eventId": "RXZlbnRfMjg1NzM=",
  "exhibitorId": "RXhoaWJpdG9yXzU5NTIx"
}
```

### Response
`target` is an `EventPerson` for people met at the event (see the [Changelog](../graphql-leads-api-changelog.md)) and a `Contact` for business card scans.

```json title="Response"
{
  "data": {
    "leads": {
      "contacts": {
        "pageInfo": {
          "endCursor": "WyIyMDI1LTA5LTAzVDEzOjI4OjMzLjAwMFoiLDExNjM0MV0=",
          "hasNextPage": true
        },
        "nodes": [
          {
            "id": "Q29ubmVjdGlvbl8xMTYzNDE=",
            "connectedAtEvent": {
              "id": "RXZlbnRfMjg1NzM=",
              "title": "Tech Event"
            },
            "connectedAt": "2025-09-03 15:28:33",
            "isScanned": true,
            "rating": 5,
            "note": "Lead to contact urgently",
            "owner": {
              "id": "VXNlcl8yNDExNg==",
              "email": "test1@gmail.com",
              "firstName": "Test",
              "lastName": "Test 1",
              "jobTitle": "CPO",
              "secondJobTitle": "",
              "photoUrl": null,
              "organization": "Swapcard",
              "websiteUrl": "https://www.test.com",
              "biography": null,
              "address": {
                "city": null,
                "country": null,
                "place": null,
                "state": null,
                "street": null,
                "zipCode": null
              },
              "phoneNumber": null,
              "socialNetworks": [
                {
                  "profile": "GUIHO_R",
                  "type": "TWITTER"
                }
              ]
            },
            "customFields": [
              {
                "__typename": "SelectField",
                "id": "RmllbGRWYWx1ZV8zMzg3ODA=",
                "value": "yes",
                "definition": {
                  "name": "Interested by the Cloud offer ?",
                  "id": "RmllbGREZWZpbml0aW9uXzI0NzYyNg=="
                }
              },
              {
                "__typename": "MultipleSelectField",
                "id": "RmllbGRWYWx1ZV8zMzg3ODI=",
                "value": "1st-sept",
                "definition": {
                  "name": "Should contacted the week of ?",
                  "id": "RmllbGREZWZpbml0aW9uXzI0NzYyNw=="
                }
              }
            ],
            "target": {
              "id": "VXNlcl8xNDc3MTg=",
              "email": "test@gmail.com",
              "firstName": "John",
              "lastName": "Doe",
              "jobTitle": null,
              "secondJobTitle": null,
              "photoUrl": null,
              "organization": null,
              "websiteUrl": null,
              "biography": null,
              "address": null,
              "phoneNumbers": null,
              "socialNetworks": []
            }
          }
        ]
      }
    }
  }
}
```

## Paginate and filter leads

The `contacts` field returns one page of leads at a time. When `pageInfo.hasNextPage` is `true`, pass `endCursor` as `cursor.after` on `contacts` to get the next page.

`contacts` accepts these optional arguments:

| Argument | Type |
| --- | --- |
| `cursor` | [`CursorPaginationInput`](../graphql-exhibitor-api-schema/types/inputs/cursor-pagination-input.mdx) |
| `sort` | [`ExhibitorLeadsContactsSortInput`](../graphql-exhibitor-api-schema/types/inputs/exhibitor-leads-contacts-sort-input.mdx) |
| `dateRange` | [`DateRangeInput`](../graphql-exhibitor-api-schema/types/inputs/date-range-input.mdx) |
| `withDuplicate` | `Boolean` |
