Set Shards

POST {{URL}}/v1/account/shards

The WhatsApp Business API Client uses sharding to achieve multiconnect. Depending on the number of shards you set up, the database stores a shard map that determines which shard a message should go to depending on the recipient ID (or WhatsApp username). The function to determine this is:

shard_id = hash(recipient-id) % shard-number

Response Parameters

NameDescription
cc
Type: String
Required.
The country code for the phone number registered for this WhatsApp Business API Client as a string. For example: "1".
phone_number
Type: String
Required.
The phone number registered for this WhatsApp Business API Client without the country code or plus symbol (+) as a string. For example: "6315550000".
shards
Type: Integer
Required.
The number of shards you want to have as an integer.

Options: 1, 2, 4, 8, 16, or 32
pin
Type: String
Optional.
The existing 6-digit PIN for two-factor verification as a string. For example: "123456". This is only required if you have two-factor verification enabled on this account.
cert
Type: String
Required.
A Base64-encoded certificate associated with the phone number previously specified.

You can get this certificate using Business Manager. See Copy the Base64-encoded Certificate for information.

Notes:
  • If you provide an expired certificate, your account will be banned.
  • If you provide a wrong certificate, you will get an error saying that your client setup is logged off. To set your shards, you need to call the endpoint again, using the correct certificate.
  • Starting in v2.45, the cert parameter is now required. Ensure that you update your integration to always include a valid certificate when calling the shards node.

Response

If successful, the API call returns 201 Created : You successfully changed shard number.

If not successful, The API call returns 403 Forbidden : You could hit this if server is temporarily unavailable, retry the request should fix it.

Troubleshooting

If there has been more than 7 days since you registered your phone number, the set shards API request will disconnect your phone number.

Request Body

{"cc"=>"{{Country-Code}}", "phone_number"=>"{{Phone-Number}}", "shards"=>"1 | 2 | 4 | 8 | 16 | 32", "pin"=>"{{Two-Step-PIN}}", "cert"=>"<your-verified-name-cert-in-base64>"}

HEADERS

KeyDatatypeRequiredDescription
Content-Typestring
Authorizationstring

RESPONSES

status: Created

&quot;201 Created   : You successfully changed shard number &quot;