API Reference - Contacts

Link: https://support.brilliantdirectories.com/support/solutions/articles/12000108079

← Back to API Reference | Getting Started

Contacts

Contacts are individuals stored in your directory's address book. They are separate from member accounts and are typically used to track leads, clients, or other contacts associated with your site. Contacts can be linked to other records via the Contact Links model.

Model name in URL: contacts — DB table: contacts

The Contact Object

FieldTypeDescription
contact_idintegerUnique contact ID (primary key, read-only)
first_namestringContact's first name
last_namestringContact's last name
emailstringEmail address
companystringCompany or organization name
phone_numberstringPrimary phone number
fax_numberstringFax number
address1stringPrimary address line
address2stringSecondary address line (suite, unit, etc.)
citystringCity
zip_codestringPostal/ZIP code
state_codestringState or province code (EG FL, CA)
country_codestringTwo-letter country code (EG US)
websitestringContact's website URL
twitterstringTwitter handle or profile URL
facebookstringFacebook profile URL
linkedinstringLinkedIn profile URL
blogtextBlog URL or notes
activeintegerActive status: 1 active, 0 inactive
tokenstringUnique contact token
positionstringJob title or position
professionstringProfession or industry
dobstringDate of birth
date_createdstringDate record was created (format: YYYYMMDDHHmmss)
created_bystringWho created the contact (EG Website, admin)
date_updatedstringDate record was last updated (format: YYYYMMDDHHmmss)
updated_bystringWho last updated the contact
rel_dbstringRelated database table name (for linking to another record)
rel_idintegerRelated record ID in the rel_db table
additionaltextAdditional notes or data
additional_fieldstextJSON-encoded custom field values
ipstringIP address of the submitter
revision_timestamptimestampTimestamp of last record modification (auto-managed)
user_consenttextRecord of user consent (GDPR/privacy compliance)
cidstringVirtual filter field for contact grouping
afterstringCursor pagination field
bucketstringVirtual filter field for contact bucketing

List Contacts

GET /api/v2/contacts/get

Example Request

Copy
curl -X GET "https://www.yourdomain.com/api/v2/contacts/get?limit=25" \
  -H "X-Api-Key: your-api-key-here"

Example Response

Copy
{
  "status": "success",
  "message": [
    {
      "contact_id": "1",
      "first_name": "Jane",
      "last_name": "Smith",
      "email": "jane@example.com",
      "company": "Acme Corp",
      "phone_number": "555-123-4567",
      "fax_number": null,
      "address1": "123 Main St",
      "address2": null,
      "city": "Miami",
      "zip_code": "33101",
      "state_code": "FL",
      "country_code": "US",
      "website": "https://example.com",
      "twitter": null,
      "facebook": null,
      "linkedin": null,
      "blog": "",
      "active": "1",
      "token": "",
      "position": "Manager",
      "profession": "",
      "dob": "",
      "date_created": "20240301120000",
      "created_by": "Website",
      "date_updated": "20240301120000",
      "updated_by": "Website",
      "rel_db": "",
      "rel_id": "0",
      "additional": "",
      "additional_fields": "",
      "ip": "",
      "revision_timestamp": "2024-03-01 12:00:00",
      "user_consent": ""
    }
  ],
  "total": "238",
  "current_page": 1,
  "total_pages": 10,
  "next_page": "MipfKjI1"
}

Retrieve a Contact

GET /api/v2/contacts/get/{contact_id}

Example Request

Copy
curl -X GET "https://www.yourdomain.com/api/v2/contacts/get/1" \
  -H "X-Api-Key: your-api-key-here"

Example Response

Copy
{
  "status": "success",
  "message": [
    {
      "contact_id": "1",
      "first_name": "Jane",
      "last_name": "Smith",
      "email": "jane@example.com",
      "company": "Acme Corp",
      "phone_number": "555-123-4567",
      "city": "Miami",
      "state_code": "FL",
      "zip_code": "33101",
      "country_code": "US",
      "active": "1",
      "date_created": "20240301120000",
      "revision_timestamp": "2024-03-01 12:00:00"
    }
  ],
  "total": "238",
  "current_page": 1,
  "total_pages": 10
}

Create a Contact

POST /api/v2/contacts/create

Example Request

Copy
curl -X POST "https://www.yourdomain.com/api/v2/contacts/create" \
  -H "X-Api-Key: your-api-key-here" \
  -d "first_name=Jane" \
  -d "last_name=Smith" \
  -d "email=jane@example.com" \
  -d "phone_number=555-123-4567" \
  -d "company=Acme+Corp" \
  -d "city=Miami" \
  -d "state_code=FL" \
  -d "zip_code=33101" \
  -d "country_code=US"

Example Response

Copy
{
  "status": "success",
  "message": {
    "contact_id": "239",
    "first_name": "Jane",
    "last_name": "Smith",
    "email": "jane@example.com",
    "company": null,
    "phone_number": "555-123-4567",
    "fax_number": null,
    "address1": null,
    "address2": null,
    "city": "Miami",
    "zip_code": "33101",
    "state_code": "FL",
    "country_code": "US",
    "website": null,
    "twitter": null,
    "facebook": null,
    "linkedin": null,
    "blog": null,
    "active": null,
    "token": null,
    "position": null,
    "profession": null,
    "dob": null,
    "date_created": null,
    "created_by": null,
    "date_updated": null,
    "updated_by": null,
    "rel_db": null,
    "rel_id": null,
    "additional": null,
    "additional_fields": null,
    "ip": null,
    "revision_timestamp": null,
    "user_consent": null
  }
}

Update a Contact

PUT /api/v2/contacts/update

Example Request

Copy
curl -X PUT "https://www.yourdomain.com/api/v2/contacts/update" \
  -H "X-Api-Key: your-api-key-here" \
  -d "contact_id=239" \
  -d "city=Orlando" \
  -d "phone_number=555-987-6543"

Example Response

Copy
{
  "status": "success",
  "message": {
    "contact_id": "239",
    "first_name": "Jane",
    "last_name": "Smith",
    "email": "jane@example.com",
    "company": "Acme Corp",
    "phone_number": "555-987-6543",
    "city": "Orlando",
    "state_code": "FL",
    "zip_code": "33101",
    "country_code": "US",
    "active": "1",
    "revision_timestamp": "2024-03-02 09:15:00"
  }
}

Delete a Contact

DELETE /api/v2/contacts/delete

Example Request

Copy
curl -X DELETE "https://www.yourdomain.com/api/v2/contacts/delete" \
  -H "X-Api-Key: your-api-key-here" \
  -d "contact_id=239"

Example Response

Copy
{
  "status": "success",
  "message": "contacts record was deleted"
}