Create Contact Property
Overview
The Create Contact Property API allows you to define and add custom properties for contacts within a specific workspace.
Endpoint
POST https://api.swipeone.com/api/workspaces/{workspaceId}/contact-properties
Authentication
This endpoint requires an API key, which should be passed in the request header as x-api-key
.
Headers
Header | Type | Required | Description |
|
| Yes | Your API key for authentication. |
Path Parameters
Parameter | Type | Required | Description |
|
| Yes | Unique identifier of the workspace where the contact property will be created. |
Request Body
The request must include a JSON object containing the following fields:
Field | Type | Required | Condition |
|
| Yes | The human-readable label for the contact property. |
|
| No (optional) | The unique name of the contact property (lowercase, no spaces). |
|
| Yes | Must be one of : |
|
| Optional ( Only if | Valid values: |
|
| Optional ( Only if
| - |
|
| Yes ( Only if | Valid values: |
|
| Yes ( Only if | - |
|
| Yes ( Only if | Must contain: |
|
| Yes ( Only if | Items are objects of the form:
|
|
| Optional ( Only if | - |
selectable options.
Example Request
POST https://api.swipeone.com/api/workspaces/6660175570fbd8a9c22bedfb/contact-properties
Content-Type: application/json
x-api-key: YOUR_API_KEY
{
"label": "Subscription Status",
"name": "subscriptionStatus",
"dataType": "string"
}
Example Response (Success)
{
"status": "success",
"data": {
"contactProperty": {
"_id": "6682840d9286aa59ee3d4181",
"label": "Subscription Status",
"name": "subscriptionStatus",
"dataType": "string",
"workspaceId": "6660175570fbd8a9c22bedfb",
"__v": 0
}
}
}
Response Codes
Status Code | Description |
| Contact property was successfully created. |
| Invalid input or duplicate property name. |
Error Example (Duplicate Property)
{
"status": "error",
"message": "You can't create contact properties with the same name as a default contact property."
}
Get All Contact Properties
Overview
The Get All Contact Properties API allows you to retrieve all defined contact properties within a specific workspace.
Endpoint
GET https://api.swipeone.com/api/workspaces/{workspaceId}/contact-properties
Authentication
This endpoint requires an API key, which should be passed in the request header as x-api-key
.
Headers
Header | Type | Required | Description |
|
| Yes | Your API key for authentication. |
Path Parameters
Parameter | Type | Required | Description |
|
| Yes | Unique identifier of the workspace to fetch contact properties from. |
Example Request
GET https://api.swipeone.com/api/workspaces/6660175570fbd8a9c22bedfb/contact-properties
x-api-key: YOUR_API_KEY
Example Response (Success)
{
"status": "success",
"data": {
"count": 3,
"contactProperties": [
{
"name": "firstName",
"label": "First Name",
"dataType": "string"
},
{
"name": "lastName",
"label": "Last Name",
"dataType": "string"
},
{
"name": "subscriptionStatus",
"label": "Subscription Status",
"dataType": "string"
}
]
}
}
Response Codes
Status Code | Description |
| Successfully retrieved all contact properties. |
| Invalid workspace ID. |
| No contact properties found for the given workspace. |
Error Example (Invalid Workspace ID)
{
"status": "error",
"message": "Invalid workspace ID"
}
Retrieve Contact Property by ID
Endpoint
GET /contact-properties/:contactPropertyId
Description
This endpoint retrieves a specific contact property using the provided contact property ID.
Base URL
https://api.swipeone.com/api
Authentication
Method: API Key Authentication
Header:
x-api-key: {your_api_key}
Request Parameters
Parameter | Type | Required | Description |
|
| Yes | The unique ID of the contact property to retrieve. |
Response
Success Response (200)
When the contact property is successfully retrieved:
{
"status": "success",
"data": {
"contactProperty": {
"_id": "6682840d9286aa59ee3d4181",
"label": "Subscription Status",
"name": "subscriptionStatus",
"dataType": "string",
"workspaceId": "6660175570fbd8a9c22bedfb",
"__v": 0
}
}
}
Error Responses
Status Code | Description |
| Contact property not found. |
| Unauthorized β API key is missing or invalid. |
| Internal server error. |
Example Error Response (404)
{
"status": "fail",
"message": "Contact property not found"
}
Headers
Header | Type | Required | Description |
|
| Yes | Your API key for authentication. |
Example Request
curl -X GET "https://api.swipeone.com/api/contact-properties/6682840d9286aa59ee3d4181" \
-H "x-api-key: YOUR_API_KEY"
Notes
This endpoint retrieves a single contact property based on its ID.
Ensure that the
contactPropertyId
provided is correct and exists in the system.