# Introduction

You can interact with our V2 API through simple HTTP requests from any language. Our V2 API is currently available on this endpoint:

Copy

```
https://api.gleantap.com/v2/ExternalApi
```

#### Generate your API Keys <a href="#generate-your-api-keys" id="generate-your-api-keys"></a>

To generate your API Keys go to "Settings" from the top right menu and click "API" and then "Generate a New Key".

You can generate as many API keys you like and can delete inactive ones to avoid abuse.

#### Rate Limits <a href="#rate-limits" id="rate-limits"></a>

All accounts will default to a maximum of 1000 calls per 24 hours. It's a rolling 24-hour window. If you go above 1000 calls, you'll receive a 429 status code with the error - "You have exceeded your rate limit".

If you need more than 1000 calls a day, please reach out to our support at <support@gleantap.com>


# Attribute List

## Get list of attributes

> Retrieve the list of available attributes for the account

```json
{"openapi":"3.0.0","info":{"title":"Gleantap External API","version":"1.0.0"},"tags":[{"name":"Attributes","description":"Attributes"}],"servers":[{"url":"https://api.gleantap.com","description":"Production server"}],"paths":{"/v2/ExternalApi/getAttributeList":{"post":{"tags":["Attributes"],"summary":"Get list of attributes","description":"Retrieve the list of available attributes for the account","operationId":"53da34ed14a8cd5ca8b739a3ba7f1ff5","parameters":[{"name":"X-API-KEY","in":"header","description":"Your API key","required":true,"schema":{"type":"string"}},{"name":"X-SECRET-KEY","in":"header","description":"Your Secret key","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["app_id"],"properties":{"app_id":{"type":"string"}},"type":"object"}}}},"responses":{"200":{"description":"List of attributes retrieved successfully","content":{"application/json":{"schema":{"properties":{"attributes":{"type":"array","items":{"properties":{"key":{"type":"string"},"label":{"type":"string"}},"type":"object"}}},"type":"object"}}}},"401":{"description":"Invalid API key or secret key"}}}}}}
```


# Attribute Event List

## Get list of event attributes

> Retrieve the list of available event attributes for the account

```json
{"openapi":"3.0.0","info":{"title":"Gleantap External API","version":"1.0.0"},"tags":[{"name":"Attributes","description":"Attributes"}],"servers":[{"url":"https://api.gleantap.com","description":"Production server"}],"paths":{"/v2/ExternalApi/getAttributeEventList":{"post":{"tags":["Attributes"],"summary":"Get list of event attributes","description":"Retrieve the list of available event attributes for the account","operationId":"759c86a42beed17d90d9918ec057b77b","parameters":[{"name":"X-API-KEY","in":"header","description":"Your API key","required":true,"schema":{"type":"string"}},{"name":"X-SECRET-KEY","in":"header","description":"Your Secret key","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["app_id"],"properties":{"app_id":{"type":"string"}},"type":"object"}}}},"responses":{"200":{"description":"List of event attributes retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"properties":{"key":{"type":"string"},"label":{"type":"string"}},"type":"object"}}}}},"401":{"description":"Invalid API key or secret key"}}}}}}
```


# Locations

## Get locations list

> Retrieve list of locations with optional filters

```json
{"openapi":"3.0.0","info":{"title":"Gleantap External API","version":"1.0.0"},"tags":[{"name":"Locations","description":"Locations"}],"servers":[{"url":"https://api.gleantap.com","description":"Production server"}],"paths":{"/v2/ExternalApi/getLocations":{"post":{"tags":["Locations"],"summary":"Get locations list","description":"Retrieve list of locations with optional filters","operationId":"d302402bddcc90938214587bc87622ea","parameters":[{"name":"X-API-KEY","in":"header","description":"Your API key","required":true,"schema":{"type":"string"}},{"name":"X-SECRET-KEY","in":"header","description":"Your Secret key","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["app_id"],"properties":{"app_id":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"}},"type":"object"}}}},"responses":{"200":{"description":"List of locations retrieved successfully","content":{"application/json":{"schema":{"properties":{"result":{"type":"array","items":{"properties":{"id":{"type":"string"},"name":{"type":"string"},"address":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"timezone":{"type":"string"},"hours":{"type":"string"}},"type":"object"}}},"type":"object"}}}},"400":{"description":"Invalid request"}}}}}}
```


# Class Schedule

## View class schedule

> Retrieve class schedule with optional filters

```json
{"openapi":"3.0.0","info":{"title":"Gleantap External API","version":"1.0.0"},"tags":[{"name":"Classes","description":"Classes"}],"servers":[{"url":"https://api.gleantap.com","description":"Production server"}],"paths":{"/v2/ExternalApi/viewClassSchedule":{"post":{"tags":["Classes"],"summary":"View class schedule","description":"Retrieve class schedule with optional filters","operationId":"20471a00eea6ad7c48161abec4b780c7","parameters":[{"name":"X-API-KEY","in":"header","description":"Your API key","required":true,"schema":{"type":"string"}},{"name":"X-SECRET-KEY","in":"header","description":"Your Secret key","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["app_id"],"properties":{"app_id":{"type":"string"},"class_name":{"type":"string"},"class_category":{"type":"string"},"staff_name":{"type":"string"},"program_name":{"type":"string"},"date":{"type":"string","format":"date"}},"type":"object"}}}},"responses":{"200":{"description":"Class schedule retrieved successfully","content":{"application/json":{"schema":{"properties":{"result":{"type":"array","items":{"properties":{"class_id":{"type":"string"},"class_name":{"type":"string"},"class_category":{"type":"string"},"staff_name":{"type":"string"},"program_name":{"type":"string"},"date":{"type":"string","format":"date"},"start_time":{"type":"string","format":"time"},"end_time":{"type":"string","format":"time"}},"type":"object"}}},"type":"object"}}}},"400":{"description":"Invalid request"}}}}}}
```


# Customers

## Get customers list

> Retrieve list of customers with optional filters

```json
{"openapi":"3.0.0","info":{"title":"Gleantap External API","version":"1.0.0"},"tags":[{"name":"Contacts","description":"Contacts"}],"servers":[{"url":"https://api.gleantap.com","description":"Production server"}],"paths":{"/v2/ExternalApi/getCustomers":{"post":{"tags":["Contacts"],"summary":"Get customers list","description":"Retrieve list of customers with optional filters","operationId":"34ca237468cb769b2d1e7b41f622f8aa","parameters":[{"name":"X-API-KEY","in":"header","description":"Your API key","required":true,"schema":{"type":"string"}},{"name":"X-SECRET-KEY","in":"header","description":"Your Secret key","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["app_id"],"properties":{"app_id":{"type":"string"},"_id":{"type":"string"},"user_id":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"event_since_date":{"type":"string","format":"date"},"updated_since":{"type":"string","format":"date"},"limit":{"type":"integer","maximum":1000},"offset":{"type":"integer"},"fulldata":{"description":"If true, the response will include all data for the customer including visits, purchases, memberships, and sales notes","type":"boolean"},"events":{"description":"If true, the response will include all events for the customer","type":"boolean"}},"type":"object"}}}},"responses":{"200":{"description":"Customers list retrieved successfully","content":{"application/json":{"schema":{"properties":{"members":{"type":"array","items":{"properties":{"id":{"type":"string"},"firstname":{"type":"string"},"lastname":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"last_location":{"type":"string"},"email_optout":{"type":"integer"},"sms_optout":{"type":"integer"},"created_date":{"type":"string","format":"date-time"}},"type":"object"}}},"type":"object"}}}},"400":{"description":"Invalid request"}}}}}}
```


# Events for a Customer

## Get events for a customer

> Retrieve list of events for a specific customer

```json
{"openapi":"3.0.0","info":{"title":"Gleantap External API","version":"1.0.0"},"tags":[{"name":"Events","description":"Events"}],"servers":[{"url":"https://api.gleantap.com","description":"Production server"}],"paths":{"/v2/ExternalApi/getEvents":{"post":{"tags":["Events"],"summary":"Get events for a customer","description":"Retrieve list of events for a specific customer","operationId":"d2fbd6c16fb737ffd687aeb1d681b202","parameters":[{"name":"X-API-KEY","in":"header","description":"Your API key","required":true,"schema":{"type":"string"}},{"name":"X-SECRET-KEY","in":"header","description":"Your Secret key","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["user_id","app_id"],"properties":{"app_id":{"type":"string"},"user_id":{"type":"string"},"limit":{"type":"integer","maximum":1000},"offset":{"type":"integer"}},"type":"object"}}}},"responses":{"200":{"description":"Events retrieved successfully","content":{"application/json":{"schema":{"properties":{"events":{"type":"array","items":{"type":"object"}}},"type":"object"}}}},"400":{"description":"Invalid request"}}}}}}
```


# Opted In Customers

## Get opted-in customers

> Retrieve list of customers who have opted in for communications

```json
{"openapi":"3.0.0","info":{"title":"Gleantap External API","version":"1.0.0"},"tags":[{"name":"Contacts","description":"Contacts"}],"servers":[{"url":"https://api.gleantap.com","description":"Production server"}],"paths":{"/v2/ExternalApi/getOptinCustomers":{"post":{"tags":["Contacts"],"summary":"Get opted-in customers","description":"Retrieve list of customers who have opted in for communications","operationId":"49216564a3968f89715501fbad33d396","parameters":[{"name":"X-API-KEY","in":"header","description":"Your API key","required":true,"schema":{"type":"string"}},{"name":"X-SECRET-KEY","in":"header","description":"Your Secret key","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["app_id"],"properties":{"app_id":{"type":"string"},"limit":{"type":"integer","maximum":1000},"offset":{"type":"integer"}},"type":"object"}}}},"responses":{"200":{"description":"Opted-in customers retrieved successfully","content":{"application/json":{"schema":{"properties":{"members":{"type":"array","items":{"properties":{"id":{"type":"string"},"firstname":{"type":"string"},"lastname":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"add_date":{"type":"string","format":"date"}},"type":"object"}}},"type":"object"}}}},"400":{"description":"Invalid request"}}}}}}
```


# Campaigns

## Get campaigns list

> Retrieve list of campaigns with optional filters

```json
{"openapi":"3.0.0","info":{"title":"Gleantap External API","version":"1.0.0"},"tags":[{"name":"Campaigns","description":"Campaigns"}],"servers":[{"url":"https://api.gleantap.com","description":"Production server"}],"paths":{"/v2/ExternalApi/getCampaigns":{"post":{"tags":["Campaigns"],"summary":"Get campaigns list","description":"Retrieve list of campaigns with optional filters","operationId":"bb698408d05f7ba4f7f9bed138f71067","parameters":[{"name":"X-API-KEY","in":"header","description":"Your API key","required":true,"schema":{"type":"string"}},{"name":"X-SECRET-KEY","in":"header","description":"Your Secret key","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["app_id"],"properties":{"app_id":{"type":"string"},"campaign_id":{"type":"string"},"updated_since":{"type":"string","format":"date"},"created_since":{"type":"string","format":"date"},"limit":{"type":"integer","maximum":1000},"offset":{"type":"integer"}},"type":"object"}}}},"responses":{"200":{"description":"Campaigns retrieved successfully","content":{"application/json":{"schema":{"properties":{"campaigns":{"type":"array","items":{"properties":{"id":{"type":"string"},"campaign_name":{"type":"string"},"status":{"type":"string"},"type":{"type":"string"},"schedule":{"type":"string"},"created_by":{"type":"string"},"created_on":{"type":"string","format":"date"},"subject":{"type":"string"},"sent":{"type":"integer"},"opened":{"type":"integer"},"clicked":{"type":"integer"}},"type":"object"}}},"type":"object"}}}},"400":{"description":"Invalid request"}}}}}}
```


# Opted Out Customers

## Get opted-out customers

> Retrieve list of customers who have opted out of communications

```json
{"openapi":"3.0.0","info":{"title":"Gleantap External API","version":"1.0.0"},"tags":[{"name":"Contacts","description":"Contacts"}],"servers":[{"url":"https://api.gleantap.com","description":"Production server"}],"paths":{"/v2/ExternalApi/getOptoutCustomers":{"post":{"tags":["Contacts"],"summary":"Get opted-out customers","description":"Retrieve list of customers who have opted out of communications","operationId":"e5da7c72f263feed6037626e7c825579","parameters":[{"name":"X-API-KEY","in":"header","description":"Your API key","required":true,"schema":{"type":"string"}},{"name":"X-SECRET-KEY","in":"header","description":"Your Secret key","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["app_id"],"properties":{"app_id":{"type":"string"},"limit":{"type":"integer","maximum":1000},"offset":{"type":"integer"},"type":{"type":"string","enum":["email","sms"]}},"type":"object"}}}},"responses":{"200":{"description":"Opted-out customers retrieved successfully","content":{"application/json":{"schema":{"properties":{"members":{"type":"array","items":{"properties":{"id":{"type":"string"},"firstname":{"type":"string"},"lastname":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"email_optout":{"type":"integer"},"sms_optout":{"type":"integer"},"optout_date":{"type":"string","format":"date-time"}},"type":"object"}}},"type":"object"}}}},"400":{"description":"Invalid request"}}}}}}
```


# Workrooms

## Get list of workrooms

> Retrieve the list of available workrooms for the account

```json
{"openapi":"3.0.0","info":{"title":"Gleantap External API","version":"1.0.0"},"tags":[{"name":"Workrooms","description":"Workrooms"}],"servers":[{"url":"https://api.gleantap.com","description":"Production server"}],"paths":{"/v2/ExternalApi/getWorkrooms":{"get":{"tags":["Workrooms"],"summary":"Get list of workrooms","description":"Retrieve the list of available workrooms for the account","operationId":"d3c89fe65c44c387ea2526468f56baa4","parameters":[{"name":"X-API-KEY","in":"header","description":"Your API key","required":true,"schema":{"type":"string"}},{"name":"X-SECRET-KEY","in":"header","description":"Your Secret key","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Workrooms list retrieved successfully","content":{"application/json":{"schema":{"properties":{"status":{"type":"string"},"workrooms":{"type":"array","items":{"properties":{"app_id":{"type":"string"},"app_name":{"type":"string"},"integrations":{"type":"array","items":{"properties":{"type":{"type":"string"},"status":{"type":"string"},"data":{"type":"object"}},"type":"object"}}},"type":"object"}}},"type":"object"}}}},"401":{"description":"Invalid API key or secret key"},"429":{"description":"Too many requests in a day"}}}}}}
```


# Forms

## Get forms by app ID

> Retrieves a list of forms associated with a given app ID.

```json
{"openapi":"3.0.0","info":{"title":"Gleantap External API","version":"1.0.0"},"tags":[{"name":"Forms","description":"Forms"}],"servers":[{"url":"https://api.gleantap.com","description":"Production server"}],"paths":{"/v2/ExternalApi/getForms/{app_id}":{"get":{"tags":["Forms"],"summary":"Get forms by app ID","description":"Retrieves a list of forms associated with a given app ID.","operationId":"getForms","parameters":[{"name":"app_id","in":"path","description":"App ID","required":true,"schema":{"type":"string"}},{"name":"X-API-KEY","in":"header","description":"Your API key","required":true,"schema":{"type":"string"}},{"name":"X-SECRET-KEY","in":"header","description":"Your Secret key","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"List of forms","content":{"application/json":{"schema":{"type":"array","items":{"properties":{"form_id":{"description":"Form ID","type":"string"},"name":{"description":"Form name","type":"string"},"title":{"description":"Form title","type":"string"},"created_on":{"description":"Form creation date","type":"string"},"status":{"description":"Form status","type":"integer"},"updated_on":{"description":"Form update date","type":"string"},"leads_count":{"description":"Number of leads","type":"integer"},"last_lead_date":{"description":"Date of the last lead","type":"string"}},"type":"object"}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"properties":{"status":{"type":"string"},"message":{"type":"string"}},"type":"object"}}}},"429":{"description":"Too many requests in a day","content":{"application/json":{"schema":{"properties":{"status":{"type":"string"},"message":{"type":"string"}},"type":"object"}}}}}}}}}
```


# Form Submissions

## Get form submissions

> Retrieves form submissions based on the provided form ID, offset, and limit.

```json
{"openapi":"3.0.0","info":{"title":"Gleantap External API","version":"1.0.0"},"tags":[{"name":"External API","description":"External API endpoints for GleanTap integration"}],"servers":[{"url":"https://api.gleantap.com","description":"Production server"}],"paths":{"/v2/ExternalApi/getFormSubmissions/{form_id}":{"post":{"tags":["External API"],"summary":"Get form submissions","description":"Retrieves form submissions based on the provided form ID, offset, and limit.","operationId":"2add7cfc6e6449b4a2d2f216c5da4c61","parameters":[{"name":"form_id","in":"path","description":"Form ID","required":true,"schema":{"type":"string"}},{"name":"X-API-KEY","in":"header","description":"Your API key","required":true,"schema":{"type":"string"}},{"name":"X-SECRET-KEY","in":"header","description":"Your Secret key","required":true,"schema":{"type":"string"}}],"requestBody":{"description":"Form submission retrieval parameters","required":true,"content":{"application/json":{"schema":{"required":["offset","limit"],"properties":{"offset":{"description":"The offset for pagination","type":"integer"},"limit":{"description":"The limit for pagination","type":"integer"},"user_id":{"description":"The user ID to filter submissions by","type":"string"}},"type":"object"}}}},"responses":{"200":{"description":"Form submissions retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"properties":{"form_id":{"description":"The ID of the form","type":"string"},"submission_id":{"description":"The ID of the submission","type":"string"},"submission_data":{"description":"The data submitted in the form","type":"object"},"submission_date":{"description":"The date and time of the submission","type":"string","format":"date-time"}},"type":"object"}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"properties":{"status":{"type":"string"},"message":{"type":"string"}},"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"properties":{"status":{"type":"string"},"message":{"type":"string"}},"type":"object"}}}},"404":{"description":"Form not found","content":{"application/json":{"schema":{"properties":{"status":{"type":"string"},"message":{"type":"string"}},"type":"object"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"properties":{"status":{"type":"string"},"message":{"type":"string"}},"type":"object"}}}}}}}}}
```


# Create or Update Location

## Create or update location

> Create a new location or update existing location details

```json
{"openapi":"3.0.0","info":{"title":"Gleantap External API","version":"1.0.0"},"tags":[{"name":"Locations","description":"Locations"}],"servers":[{"url":"https://api.gleantap.com","description":"Production server"}],"paths":{"/v2/ExternalApi/newLocation":{"post":{"tags":["Locations"],"summary":"Create or update location","description":"Create a new location or update existing location details","operationId":"a7ec5af15b32eb886dbcbddf1f6f42ef","parameters":[{"name":"X-API-KEY","in":"header","description":"Your API key","required":true,"schema":{"type":"string"}},{"name":"X-SECRET-KEY","in":"header","description":"Your Secret key","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["app_id","id","name"],"properties":{"app_id":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"},"address":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"},"timezone":{"type":"string"},"hours":{"type":"string"}},"type":"object"}}}},"responses":{"200":{"description":"Location created/updated successfully","content":{"application/json":{"schema":{"properties":{"result":{"type":"string"}},"type":"object"}}}},"400":{"description":"Invalid request"}}}}}}
```


# Create a Class

## Create a new class

> Create a new class with specified details

```json
{"openapi":"3.0.0","info":{"title":"Gleantap External API","version":"1.0.0"},"tags":[{"name":"Classes","description":"Classes"}],"servers":[{"url":"https://api.gleantap.com","description":"Production server"}],"paths":{"/v2/ExternalApi/newClass":{"post":{"tags":["Classes"],"summary":"Create a new class","description":"Create a new class with specified details","operationId":"3fd617064ef9b9459de32029d1f137c8","parameters":[{"name":"X-API-KEY","in":"header","description":"Your API key","required":true,"schema":{"type":"string"}},{"name":"X-SECRET-KEY","in":"header","description":"Your Secret key","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["id","date","start_time","app_id"],"properties":{"app_id":{"type":"string"},"id":{"type":"string"},"class_name":{"type":"string"},"class_category":{"type":"string"},"staff_name":{"type":"string"},"program_name":{"type":"string"},"date":{"type":"string","format":"date"},"start_time":{"type":"string","format":"time"},"end_time":{"type":"string","format":"time"}},"type":"object"}}}},"responses":{"200":{"description":"Class created successfully","content":{"application/json":{"schema":{"properties":{"result":{"type":"string"}},"type":"object"}}}},"400":{"description":"Invalid request"}}}}}}
```


# Delete Class

## Delete a class

> Delete an existing class from the system

```json
{"openapi":"3.0.0","info":{"title":"Gleantap External API","version":"1.0.0"},"tags":[{"name":"Classes","description":"Classes"}],"servers":[{"url":"https://api.gleantap.com","description":"Production server"}],"paths":{"/v2/ExternalApi/deleteClass":{"post":{"tags":["Classes"],"summary":"Delete a class","description":"Delete an existing class from the system","operationId":"dfc0c47f822bc7a929cbec62c602fe13","parameters":[{"name":"X-API-KEY","in":"header","description":"Your API key","required":true,"schema":{"type":"string"}},{"name":"X-SECRET-KEY","in":"header","description":"Your Secret key","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["app_id","id"],"properties":{"app_id":{"type":"string"},"id":{"type":"string"}},"type":"object"}}}},"responses":{"200":{"description":"Class deleted successfully","content":{"application/json":{"schema":{"properties":{"result":{"type":"string"}},"type":"object"}}}},"400":{"description":"Invalid request"}}}}}}
```


# Create or Update Contact

## Create new contact

> Create a new or update contact in the system. To update existing contact, provide the user\_id or the same email & firstname, or phone & firstname. In addition to the attributes listed below, you can add any custom attributes to the contact.

```json
{"openapi":"3.0.0","info":{"title":"Gleantap External API","version":"1.0.0"},"tags":[{"name":"Contacts","description":"Contacts"}],"servers":[{"url":"https://api.gleantap.com","description":"Production server"}],"paths":{"/v2/ExternalApi/newContact":{"post":{"tags":["Contacts"],"summary":"Create new contact","description":"Create a new or update contact in the system. To update existing contact, provide the user_id or the same email & firstname, or phone & firstname. In addition to the attributes listed below, you can add any custom attributes to the contact.","operationId":"aecf2e930433a1ee55c7ca351a4647d3","parameters":[{"name":"X-API-KEY","in":"header","description":"Your API key","required":true,"schema":{"type":"string"}},{"name":"X-SECRET-KEY","in":"header","description":"Your Secret key","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["app_id","first_name","last_name"],"properties":{"app_id":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"email":{"type":"string","format":"email"},"phone":{"type":"string"},"address":{"type":"string"},"city":{"type":"string"},"state":{"type":"string"},"zip":{"type":"string"},"source":{"type":"string"},"user_id":{"type":"string"},"dob":{"description":"YYYY-MM-DD","type":"string","format":"date"},"created_date":{"description":"YYYY-MM-DD HH:MM:SS","type":"string","format":"date-time"},"gender":{"type":"string"},"type":{"description":"eg. member, past, prospect","type":"string"},"status":{"description":"eg. active, inactive, non-member etc","type":"string"},"location":{"type":"string"},"optin_sms":{"type":"boolean"},"optout_email":{"type":"boolean"},"tags":{"description":"comma separated tags","type":"string"},"tag_action":{"description":"add or remove","type":"string"}},"type":"object"}}}},"responses":{"200":{"description":"Contact created successfully","content":{"application/json":{"schema":{"properties":{"status":{"type":"string"},"_id":{"type":"string"}},"type":"object"}}}},"400":{"description":"Invalid request"}}}}}}
```


# SMS Opt-in a Contact

## Opt-in a contact

> Sends a double-optin message to a contact. Once the contact responds YES, the contact will be opted in. The double optin message can be configured from the Configure SMS settings.

```json
{"openapi":"3.0.0","info":{"title":"Gleantap External API","version":"1.0.0"},"tags":[{"name":"Contacts","description":"Contacts"}],"servers":[{"url":"https://api.gleantap.com","description":"Production server"}],"paths":{"/v2/ExternalApi/optin":{"post":{"tags":["Contacts"],"summary":"Opt-in a contact","description":"Sends a double-optin message to a contact. Once the contact responds YES, the contact will be opted in. The double optin message can be configured from the Configure SMS settings.","operationId":"4e2209fe49e5005f2418712b3679e6a6","parameters":[{"name":"X-API-KEY","in":"header","description":"Your API key","required":true,"schema":{"type":"string"}},{"name":"X-SECRET-KEY","in":"header","description":"Your Secret key","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["app_id","phone","email","user_id"],"properties":{"app_id":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string","format":"email"},"user_id":{"type":"string"},"dob":{"description":"Date of birth in YYYY-MM-DD format","type":"string","format":"date"}},"type":"object"}}}},"responses":{"200":{"description":"Contact opted-in successfully","content":{"application/json":{"schema":{"properties":{"status":{"type":"string"}},"type":"object"}}}},"400":{"description":"Invalid request or age restriction"}}}}}}
```


# Add Memberships for Contact

## Create new membership

> Create a new membership for a customer. Required fields for customer - user\_id, email or phone.

```json
{"openapi":"3.0.0","info":{"title":"Gleantap External API","version":"1.0.0"},"tags":[{"name":"Memberships","description":"Memberships"}],"servers":[{"url":"https://api.gleantap.com","description":"Production server"}],"paths":{"/v2/ExternalApi/newMembership":{"post":{"tags":["Memberships"],"summary":"Create new membership","description":"Create a new membership for a customer. Required fields for customer - user_id, email or phone.","operationId":"1718f395a2fd89ab8c9754898979ff15","parameters":[{"name":"X-API-KEY","in":"header","description":"Your API key","required":true,"schema":{"type":"string"}},{"name":"X-SECRET-KEY","in":"header","description":"Your Secret key","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["app_id","email","name"],"properties":{"app_id":{"type":"string"},"user_id":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"id":{"description":"Membership ID","type":"string"},"name":{"description":"Membership Name","type":"string"},"type":{"description":"Membership Type","type":"string"},"start_date":{"description":"Membership Start Date","type":"string","format":"date"},"end_date":{"description":"Membership End Date","type":"string","format":"date"},"status":{"description":"Membership Status","type":"string"},"session_count":{"description":"Membership Session Count","type":"integer"},"session_remaining":{"description":"Membership Session Remaining","type":"integer"}},"type":"object"}}}},"responses":{"200":{"description":"Membership created successfully","content":{"application/json":{"schema":{"properties":{"result":{"type":"string"}},"type":"object"}}}},"400":{"description":"Invalid request"}}}}}}
```


# Create an Event

## Create new event

> Create a new event for a contact. To identify the contact, use either user\_id, or email & firstname or phone & firstname

```json
{"openapi":"3.0.0","info":{"title":"Gleantap External API","version":"1.0.0"},"tags":[{"name":"Events","description":"Events"}],"servers":[{"url":"https://api.gleantap.com","description":"Production server"}],"paths":{"/v2/ExternalApi/newEvent":{"post":{"tags":["Events"],"summary":"Create new event","description":"Create a new event for a contact. To identify the contact, use either user_id, or email & firstname or phone & firstname","operationId":"c7ce38012d078737c49077df38e9748b","parameters":[{"name":"X-API-KEY","in":"header","description":"Your API key","required":true,"schema":{"type":"string"}},{"name":"X-SECRET-KEY","in":"header","description":"Your Secret key","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["app_id","user_id","id","event_type","event_date"],"properties":{"app_id":{"type":"string"},"_id":{"type":"string"},"user_id":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"event_type":{"type":"string"},"event_name":{"type":"string"},"event_date":{"description":"Date of the event in YYYY-MM-DD format","type":"string","format":"date"},"event_time":{"description":"Time of the event in HH:MM AM/PM format","type":"string","format":"time"},"id":{"description":"Unique Event ID from your system","type":"string"},"is_visit":{"type":"boolean"},"is_purchase":{"type":"boolean"},"event_data":{"description":"Event data with custom fields such as status, staff etc.","type":"array","items":{"type":"object"}}},"type":"object"}}}},"responses":{"200":{"description":"Event created successfully","content":{"application/json":{"schema":{"properties":{"result":{"type":"string"}},"type":"object"}}}},"400":{"description":"Invalid request"}}}}}}
```


# Delete Contact

## Remove a contact

> Remove a contact from the system

```json
{"openapi":"3.0.0","info":{"title":"Gleantap External API","version":"1.0.0"},"tags":[{"name":"Contacts","description":"Contacts"}],"servers":[{"url":"https://api.gleantap.com","description":"Production server"}],"paths":{"/v2/ExternalApi/removeContact":{"post":{"tags":["Contacts"],"summary":"Remove a contact","description":"Remove a contact from the system","operationId":"11c8a2fc3df76273701d3ffd3fa3215a","parameters":[{"name":"X-API-KEY","in":"header","description":"Your API key","required":true,"schema":{"type":"string"}},{"name":"X-SECRET-KEY","in":"header","description":"Your Secret key","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["app_id","id"],"properties":{"app_id":{"type":"string"},"id":{"description":"Unique Gleantap Contact ID","type":"string"}},"type":"object"}}}},"responses":{"200":{"description":"Contact removed successfully","content":{"application/json":{"schema":{"properties":{"result":{"type":"string"}},"type":"object"}}}},"400":{"description":"Invalid request"}}}}}}
```


# Merge Contacts

## Merge two contacts

> Merge two contacts into a single contact, combining their data

```json
{"openapi":"3.0.0","info":{"title":"Gleantap External API","version":"1.0.0"},"tags":[{"name":"Contacts","description":"Contacts"}],"servers":[{"url":"https://api.gleantap.com","description":"Production server"}],"paths":{"/v2/ExternalApi/mergeContacts":{"post":{"tags":["Contacts"],"summary":"Merge two contacts","description":"Merge two contacts into a single contact, combining their data","operationId":"059c0d7d021b302505de2afaaa57e219","parameters":[{"name":"X-API-KEY","in":"header","description":"Your API key","required":true,"schema":{"type":"string"}},{"name":"X-SECRET-KEY","in":"header","description":"Your Secret key","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["app_id","from_contact","to_contact"],"properties":{"app_id":{"type":"string"},"from_contact":{"description":"ID of the contact that will remain after merge","type":"string"},"to_contact":{"description":"ID of the contact that will be merged and deleted","type":"string"}},"type":"object"}}}},"responses":{"200":{"description":"Contacts merged successfully","content":{"application/json":{"schema":{"properties":{"status":{"type":"boolean"},"message":{"type":"string"}},"type":"object"}}}},"400":{"description":"Invalid request or contacts not found"},"500":{"description":"Error during merge process"}}}}}}
```


# Send SMS Notification

## Send SMS notification

> Send an SMS notification to a specific contact

```json
{"openapi":"3.0.0","info":{"title":"Gleantap External API","version":"1.0.0"},"tags":[{"name":"Notifications","description":"Notifications"}],"servers":[{"url":"https://api.gleantap.com","description":"Production server"}],"paths":{"/v2/ExternalApi/sendSmsNotification/{app_id}":{"post":{"tags":["Notifications"],"summary":"Send SMS notification","description":"Send an SMS notification to a specific contact","operationId":"fb29614b0a0a451822933fc6ad466881","parameters":[{"name":"X-API-KEY","in":"header","description":"Your API key","required":true,"schema":{"type":"string"}},{"name":"X-SECRET-KEY","in":"header","description":"Your Secret key","required":true,"schema":{"type":"string"}},{"name":"app_id","in":"path","description":"Application ID","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["to_number","message"],"properties":{"_id":{"description":"Unique Gleantap Contact ID for personalization","type":"string"},"to_number":{"description":"Recipient phone number with country code","type":"string"},"message":{"description":"SMS message content","type":"string"},"from_number":{"description":"Sender phone number (optional)","type":"string"}},"type":"object"}}}},"responses":{"200":{"description":"SMS sent successfully","content":{"application/json":{"schema":{"properties":{"status":{"type":"boolean"},"message":{"type":"string"},"phone":{"type":"string"},"from":{"type":"string"},"service_type":{"type":"string","enum":["twilio","ringcentral","telnyx","edgility"]},"service_message_id":{"type":"string"}},"type":"object"}}}},"400":{"description":"Invalid request parameters"},"401":{"description":"Unauthorized - Invalid API credentials"},"500":{"description":"SMS sending failed"}}}}}}
```


# Send Email Notifications

## Send email notification

> Send an email notification to a specific contact. Either use the message parameter or use a template.

```json
{"openapi":"3.0.0","info":{"title":"Gleantap External API","version":"1.0.0"},"tags":[{"name":"Notifications","description":"Notifications"}],"servers":[{"url":"https://api.gleantap.com","description":"Production server"}],"paths":{"/v2/ExternalApi/sendEmailNotification/{app_id}":{"post":{"tags":["Notifications"],"summary":"Send email notification","description":"Send an email notification to a specific contact. Either use the message parameter or use a template.","operationId":"e3b8deb13ded307791e4f417f41f43ae","parameters":[{"name":"X-API-KEY","in":"header","description":"Your API key","required":true,"schema":{"type":"string"}},{"name":"X-SECRET-KEY","in":"header","description":"Your Secret key","required":true,"schema":{"type":"string"}},{"name":"app_id","in":"path","description":"Application ID","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"required":["to_email","subject","message"],"properties":{"_id":{"description":"Unique Gleantap Contact ID for personalization","type":"string"},"to_email":{"type":"string","format":"email"},"subject":{"type":"string"},"message":{"type":"string"},"template_id":{"description":"Email template ID (optional)","type":"string"},"attachments":{"type":"array","items":{"properties":{"name":{"type":"string"},"content":{"type":"string","format":"binary"}},"type":"object"}}},"type":"object"}}}},"responses":{"200":{"description":"Email sent successfully","content":{"application/json":{"schema":{"properties":{"status":{"type":"boolean"},"message":{"type":"string"}},"type":"object"}}}},"400":{"description":"Invalid request parameters"},"401":{"description":"Unauthorized - Invalid API credentials"},"500":{"description":"Email sending failed"}}}}}}
```


