Whats91
Developers

Create a new account-wide contact book.

Create Contact Book

Summary

Create a new account-wide contact book.

Prerequisites

  • Authorization: Bearer w91_live_xxx
  • Content-Type: application/json for JSON requests

Endpoint: POST /api/v2/contact-books. Create a contact book before linking contacts through the bulk upload endpoint. The contact book is created with ACTIVE status.

POST/api/v2/contact-books
ParameterTypeRequiredDescription
AuthorizationheaderRequiredBearer w91_public_token_here. Must be a global public API token.
Content-TypeheaderRequiredContent-Type: application/json.
authTokenstringOptionalCompatibility body token. auth_token and token are also accepted.
namestringRequiredContact book name.
descriptionstringOptionalShort explanation of the book purpose.
colorstringOptionalHex color used for dashboard grouping, for example #0f62fe.
Create contact book
curl -X POST "https://graph.whats91.com/api/v2/contact-books" \
  -H "Authorization: Bearer w91_public_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Retail Leads",
    "description": "Retail campaign contacts",
    "color": "#0f62fe"
  }'
Create response
{
  "success": true,
  "message": "Contact book created",
  "data": {
    "contactBook": {
      "contactBookUid": "grp_abc",
      "uid": "grp_abc",
      "name": "Retail Leads",
      "description": "Retail campaign contacts",
      "color": "#0f62fe",
      "status": "ACTIVE",
      "contactCount": 0
    }
  },
  "metadata": {
    "apiVersion": "v2",
    "requestId": "request-uuid"
  }
}
ACTIVE

Retail Leads

Use for contacts collected from retail campaigns or landing pages.

ACTIVE

VIP Customers

Use for high-value customers and priority broadcasts.

ACTIVE

Trial Users

Use for onboarding journeys and product education campaigns.

ACTIVE

Event Attendees

Use for event follow-up, reminders, and feedback collection.

SDK Examples

Use these examples as starting points for server-side implementations.

cURL
curl -X POST "https://graph.whats91.com/api/v2/contact-books" \
  -H "Authorization: Bearer w91_live_xxx" \
  -H "Content-Type: application/json" \
  -d 'curl -X POST "https://graph.whats91.com/api/v2/contact-books" \
  -H "Authorization: Bearer w91_public_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Retail Leads",
    "description": "Retail campaign contacts",
    "color": "#0f62fe"
  }''
Node.js
const response = await fetch("https://graph.whats91.com/api/v2/contact-books", {
  method: "POST",
  headers: {
    "Authorization": "Bearer w91_live_xxx",
    "Content-Type": "application/json"
  },
  body: JSON.stringify(curl -X POST "https://graph.whats91.com/api/v2/contact-books" \
  -H "Authorization: Bearer w91_public_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Retail Leads",
    "description": "Retail campaign contacts",
    "color": "#0f62fe"
  }')
});

const data = await response.json();
console.log(data);
PHP
$ch = curl_init("https://graph.whats91.com/api/v2/contact-books");
curl_setopt_array($ch, [
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer w91_live_xxx",
    "Content-Type: application/json"
  ],
  CURLOPT_POSTFIELDS => json_encode(curl -X POST "https://graph.whats91.com/api/v2/contact-books" \
  -H "Authorization: Bearer w91_public_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Retail Leads",
    "description": "Retail campaign contacts",
    "color": "#0f62fe"
  }')
]);

$response = curl_exec($ch);
curl_close($ch);
echo $response;
Python
import requests

response = requests.request(
    "POST",
    "https://graph.whats91.com/api/v2/contact-books",
    headers={
        "Authorization": "Bearer w91_live_xxx",
        "Content-Type": "application/json",
    },
    json=curl -X POST "https://graph.whats91.com/api/v2/contact-books" \
  -H "Authorization: Bearer w91_public_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Retail Leads",
    "description": "Retail campaign contacts",
    "color": "#0f62fe"
  }'
)

print(response.json())
C#
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer w91_live_xxx");

var request = new HttpRequestMessage(HttpMethod.Post, "https://graph.whats91.com/api/v2/contact-books");
request.Content = new StringContent(
  """curl -X POST \"https://graph.whats91.com/api/v2/contact-books\" \
  -H \"Authorization: Bearer w91_public_token_here\" \
  -H \"Content-Type: application/json\" \
  -d '{
    \"name\": \"Retail Leads\",
    \"description\": \"Retail campaign contacts\",
    \"color\": \"#0f62fe\"
  }'""",
  Encoding.UTF8,
  "application/json"
);

var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());

Related APIs