Get Contacts
curl --request GET \
--url https://api.clemta.com/contacts \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.clemta.com/contacts"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.clemta.com/contacts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.clemta.com/contacts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.clemta.com/contacts"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.clemta.com/contacts")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.clemta.com/contacts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Contacts retrieved successfully",
"data": {
"contacts": [
{
"id": "64b8f1a2e4b0c8d9f0123456",
"created_at": 1640995200,
"updated_at": 1640995200,
"type": "customer",
"status": "active",
"full_name": "John Doe",
"email": "[email protected]",
"description": "Primary contact for the company",
"cc_emails": [
"[email protected]",
"[email protected]"
],
"bcc_emails": [
"[email protected]",
"[email protected]"
],
"billing": {
"email": "[email protected]",
"phone": "1234567890",
"phone_code": "+1",
"iso_code": "US",
"country": "United States",
"address_1": "123 Main Street",
"address_2": "Suite 100",
"postal_code": "12345",
"district": "Downtown",
"state": "CA",
"province": "California",
"tax_id": "12-3456789"
}
}
],
"total": 123
}
}{
"success": false,
"message": "Invalid request data",
"data": null,
"error": {
"code": "INVALID_REQUEST",
"details": "Field 'name' is required"
}
}{
"success": false,
"message": "API key is required",
"data": null,
"error": {
"code": "API_KEY_REQUIRED",
"details": ""
}
}{
"success": false,
"message": "Company not found",
"data": null,
"error": {
"code": "COMPANY_NOT_FOUND",
"details": ""
}
}{
"success": false,
"message": "Internal server error",
"data": null,
"error": {
"code": "INTERNAL_ERROR",
"details": "An unexpected error occurred."
}
}Contacts API
List Contacts
Retrieve a list of contacts with filtering and pagination
GET
/
contacts
Get Contacts
curl --request GET \
--url https://api.clemta.com/contacts \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.clemta.com/contacts"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.clemta.com/contacts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.clemta.com/contacts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.clemta.com/contacts"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.clemta.com/contacts")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.clemta.com/contacts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Contacts retrieved successfully",
"data": {
"contacts": [
{
"id": "64b8f1a2e4b0c8d9f0123456",
"created_at": 1640995200,
"updated_at": 1640995200,
"type": "customer",
"status": "active",
"full_name": "John Doe",
"email": "[email protected]",
"description": "Primary contact for the company",
"cc_emails": [
"[email protected]",
"[email protected]"
],
"bcc_emails": [
"[email protected]",
"[email protected]"
],
"billing": {
"email": "[email protected]",
"phone": "1234567890",
"phone_code": "+1",
"iso_code": "US",
"country": "United States",
"address_1": "123 Main Street",
"address_2": "Suite 100",
"postal_code": "12345",
"district": "Downtown",
"state": "CA",
"province": "California",
"tax_id": "12-3456789"
}
}
],
"total": 123
}
}{
"success": false,
"message": "Invalid request data",
"data": null,
"error": {
"code": "INVALID_REQUEST",
"details": "Field 'name' is required"
}
}{
"success": false,
"message": "API key is required",
"data": null,
"error": {
"code": "API_KEY_REQUIRED",
"details": ""
}
}{
"success": false,
"message": "Company not found",
"data": null,
"error": {
"code": "COMPANY_NOT_FOUND",
"details": ""
}
}{
"success": false,
"message": "Internal server error",
"data": null,
"error": {
"code": "INTERNAL_ERROR",
"details": "An unexpected error occurred."
}
}List Contacts
This endpoint allows you to retrieve a list of contacts for a company with optional filtering and pagination.Headers
| Parameter | Type | Description |
|---|---|---|
| X-API-KEY | string | Formation API Key (required) |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| company_id | string | Yes | Company ID to filter contacts |
| skip | string | No | Number of records to skip (pagination) |
| limit | string | No | Number of records to return (pagination) |
| search | string | No | Search term to filter contacts |
| sort | string | No | Field to sort by |
| order | string | No | Sort order: “asc” or “desc” |
| created_at | string | No | Created at filter |
| created_at_value | string | No | Created at value |
| end_date | string | No | End date filter |
Parameter Examples
- Basic request:
GET /contacts?company_id=64b8f1a2e4b0c8d9f0123456 - With pagination:
GET /contacts?company_id=64b8f1a2e4b0c8d9f0123456&skip=0&limit=10 - With search:
GET /contacts?company_id=64b8f1a2e4b0c8d9f0123456&search=john - With sorting:
GET /contacts?company_id=64b8f1a2e4b0c8d9f0123456&sort=created_at&order=desc
Response
{
"success": true,
"message": "Contacts retrieved successfully",
"data": {
"contacts": [
{
"id": "64b8f1a2e4b0c8d9f0123456",
"created_at": 1686787200,
"updated_at": 1686787200,
"type": "customer",
"status": "active",
"full_name": "John Doe",
"email": "[email protected]",
"description": "Primary customer contact",
"cc_emails": ["[email protected]"],
"bcc_emails": ["[email protected]"],
"billing": {
"email": "[email protected]",
"phone": "+1234567890",
"phone_code": "+1",
"iso_code": "US",
"country": "United States",
"address_1": "123 Main St",
"address_2": "Suite 100",
"postal_code": "12345",
"district": "Downtown",
"state": "CA",
"province": "California",
"tax_id": "12-3456789"
}
}
],
"total": 1,
"skip": 0,
"limit": 10
}
}
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| success | boolean | Indicates if the operation was successful |
| message | string | Additional information about the operation |
| data | object | Response data for successful requests |
| data.contacts | array | Array of contact objects |
| data.total | integer | Total number of contacts |
| data.skip | integer | Number of records skipped |
| data.limit | integer | Number of records returned |
Contact Object Fields
| Field | Type | Description |
|---|---|---|
| id | string | Unique identifier for the contact |
| created_at | integer | Creation timestamp |
| updated_at | integer | Last update timestamp |
| type | string | Contact type (“customer” or “vendor”) |
| status | string | Contact status |
| full_name | string | Full name of the contact |
| string | Email address | |
| description | string | Contact description |
| cc_emails | array | CC email addresses |
| bcc_emails | array | BCC email addresses |
| billing | object | Billing information |
Error Responses
Invalid Request (400)
{
"success": false,
"message": "Invalid request data",
"error": {
"code": "INVALID_REQUEST",
"details": "Company ID is required"
}
}
Unauthorized (401)
{
"success": false,
"message": "API key is required",
"error": {
"code": "API_KEY_REQUIRED"
}
}
Company Not Found (404)
{
"success": false,
"message": "Company not found",
"error": {
"code": "COMPANY_NOT_FOUND"
}
}
Internal Server Error (500)
{
"success": false,
"message": "Internal server error",
"error": {
"code": "INTERNAL_ERROR"
}
}
Authorizations
Formation API key for authentication.
Query Parameters
Company ID
Number of records to skip
Number of records to return
Search term
Sort field
Sort order (asc/desc)
Available options:
asc, desc Created at filter
Created at value
End date filter
⌘I