Skip to main content
All CollectionsCRMAPI
Contact Properties

Contact Properties

Contact properties are attributes associated with a contact in the system

Support Team - Swipe One avatar
Written by Support Team - Swipe One
Updated over 2 months ago

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

x-api-key

string

Yes

Your API key for authentication.

Path Parameters

Parameter

Type

Required

Description

workspaceId

string

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

label

string

Yes

The human-readable label for the contact property.

name

string

No (optional)

The unique name of the contact property (lowercase, no spaces).

fieldType

string

Yes

Must be one of : text , email , phone , select , multiselect , country, url, address, person, date, number

numberFormat

string

Optional ( Only if fieldType = number )

Valid values: number , comma , percentage , currency

currency

string

Optional ( Only if numberFormat =

currency )

-

dateFormat

string

Yes ( Only if fieldType = date )

Valid values: MMM, dd, yyyy, dd/MM/yyyy , MM/dd/yyyy

includeTime

boolean

Yes ( Only if fieldType = date )

-

addressFields

object

Yes ( Only if fieldType = address )

Must contain: line1, line2, city, country , state , zipcode

options

array

Yes ( Only if fieldType is select or multiselect )

Items are objects of the form:

{ label, name?, color }

optionsName

string

Optional ( Only

if fieldType is select or multiselect )

-


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

201 Created

Contact property was successfully created.

400 Bad Request

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

x-api-key

string

Yes

Your API key for authentication.

Path Parameters

Parameter

Type

Required

Description

workspaceId

string

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

200 OK

Successfully retrieved all contact properties.

400 Bad Request

Invalid workspace ID.

404 Not Found

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

contactPropertyId

string

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

404

Contact property not found.

401

Unauthorized – API key is missing or invalid.

500

Internal server error.

Example Error Response (404)

{
"status": "fail",
"message": "Contact property not found"
}

Headers

Header

Type

Required

Description

x-api-key

string

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.

Did this answer your question?