Skip to main content

How to integrate

Integration examples for building lead scanning applications and lead export tools using the Swapcard Leads API.

This guide provides step-by-step integration examples for two common use cases:

  1. Lead Scanning Application - Build an app that allows exhibitors to scan attendee badges at events
  2. Lead Export Integration - Create a tool to export and sync lead data with external CRM systems

Integration: Lead Scanning Application

This example demonstrates how to build a lead scanning application that allows exhibitors to scan attendee badges during events.

Step 1: API Key Management

First, implement a secure way to collect and store the API key from your users.

Security Best Practice

Never store API keys in client-side code or expose them in web applications. Always store them securely on your server.

Implementation Steps:

  1. Create a settings/configuration page in your app
  2. Provide a secure input field for the API key
  3. Store the key encrypted in your database or secure storage
  4. Validate the key by making a test API call

Step 2: List Available Exhibitor Booths

Before scanning badges, users need to select which exhibitor booth they're representing. Use the myExhibitors query to retrieve all booths the user has access to.

curl -X POST \
https://developer.swapcard.com/exhibitor/graphql \
-H 'Authorization: YOUR_API_KEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
"query": "query myExhibitors($cursor: CursorPaginationInput) { myExhibitors(cursor: $cursor) { pageInfo { hasNextPage endCursor } nodes { id name events { nodes { id title } } } } }",
"variables": {
"cursor": {
"first": 100
}
}
}'

Response Example:

{
"data": {
"myExhibitors": {
"pageInfo": {
"hasNextPage": false,
"endCursor": "eyJpZCI6IjEyMzQ1In0="
},
"nodes": [
{
"id": "RXhoaWJpdG9yXzU5NTIx",
"name": "Tech Solutions Booth",
"events": {
"nodes": [
{
"id": "RXZlbnRfMjg1NzM=",
"title": "Tech Conference 2025"
}
]
}
}
]
}
}
}

Step 3: Scan Badges Implementation

Implement the badge scanning functionality using the scanBadges mutation. This supports both single scans and batch scanning for offline mode.

curl -X POST \
https://developer.swapcard.com/exhibitor/graphql \
-H 'Authorization: YOUR_API_KEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
"query": "mutation scanBadges($input: ScanBadgesInput!) { scanBadges(input: $input) { badges { errorCode connection { id rating note target { __typename ... on PersonInterface { firstName lastName jobTitle email organization } } } } } }",
"variables": {
"input": {
"eventId": "RXZlbnRfMjg1NzM=",
"exhibitorId": "RXhoaWJpdG9yXzU5NTIx",
"badges": [
{
"code": "BADGE_QR_CODE_123",
"rating": 5,
"note": "Very interested in our product"
}
]
}
}
}'

Response Example:

{
"data": {
"scanBadges": {
"badges": [
{
"errorCode": null,
"connection": {
"id": "Q29ubmVjdGlvbl8xMTYzNDE=",
"rating": 5,
"note": "Very interested in our product",
"target": {
"__typename": "User",
"firstName": "John",
"lastName": "Doe",
"jobTitle": "CTO",
"email": "john.doe@example.com",
"organization": "Tech Corp"
}
}
}
]
}
}
}

Integration: Lead Export Integration

This example shows how to build a lead export tool that synchronizes lead data with external CRM systems or exports data for analysis.

Step 1: API Key Management

Follow the same secure API key management approach as described in Integration Example 1.

Step 2: List Available Exhibitor Booths

Use the same myExhibitors query implementation from Integration Example 1 to let users select which booths to export leads from.

Step 3: Export Leads Data

Use the myLeads query to retrieve all leads for a specific exhibitor booth and event.

curl -X POST \
https://developer.swapcard.com/exhibitor/graphql \
-H 'Authorization: YOUR_API_KEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
"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 { id email firstName lastName jobTitle organization } target { ... on Contact { id email firstName lastName jobTitle organization } ... on User { id email firstName lastName jobTitle organization } } customFields { __typename ... on SelectField { id value definition { name id } } ... on TextField { id value definition { name } } } } } } }",
"variables": {
"eventId": "RXZlbnRfMjg1NzM=",
"exhibitorId": "RXhoaWJpdG9yXzU5NTIx"
}
}'

Response Example:

{
"data": {
"leads": {
"contacts": {
"pageInfo": {
"endCursor": "WyIyMDI1LTA5LTAzVDEzOjI4OjMzLjAwMFoiLDExNjM0MV0=",
"hasNextPage": false
},
"nodes": [
{
"id": "Q29ubmVjdGlvbl8xMTYzNDE=",
"connectedAtEvent": {
"id": "RXZlbnRfMjg1NzM=",
"title": "Tech Conference 2025"
},
"connectedAt": "2025-09-03 15:28:33",
"isScanned": true,
"rating": 5,
"note": "Very interested in our cloud solution",
"owner": {
"id": "VXNlcl8yNDExNg==",
"email": "exhibitor@techcorp.com",
"firstName": "Sarah",
"lastName": "Johnson",
"jobTitle": "Sales Manager",
"organization": "Tech Corp"
},
"target": {
"id": "VXNlcl8xNDc3MTg=",
"email": "john.doe@example.com",
"firstName": "John",
"lastName": "Doe",
"jobTitle": "CTO",
"organization": "Example Inc"
},
"customFields": [
{
"__typename": "SelectField",
"id": "RmllbGRWYWx1ZV8zMzg3ODA=",
"value": "yes",
"definition": {
"name": "Interested in Cloud Solution?",
"id": "RmllbGREZWZpbml0aW9uXzI0NzYyNg=="
}
}
]
}
]
}
}
}
}