Create Session

Provisions a fresh Wawp instance and returns metadata such as instance_id and session_name.

POST
https://api.wawp.net/v2/session/create?access_token=YOUR_ACCESS_TOKEN

Authentication Required

Login to swap the placeholders with your real Instance ID and Access Token.

Log In
Test /v2/session/create endpoint
POST
POST

No query parameters required

This endpoint doesn't expect data in the URL.

Best practices

  • Provision sessions 'On-Demand' to keep your dashboard clean and maximize your quota usage.

  • Always follow a Create call with a Start call to initiate the QR code generation process.

  • Ensure your database schema can handle 12-character alphanumeric strings for the 'instance_id'.

Provisioning Your Digital Infrastructure: The Create Session Endpoint

The /v2/session/create endpoint is the specialized "Factory" for Wawp instances. While it may seem like a simple registration step, it handles a sophisticated backend process of resource allocation, container provisioning, and server assignment. Understanding how to use this factory efficiently is the foundation of a scalable WhatsApp integration.


🛠️ The Provisioning Architecture

When you call create, Wawp does not just create a record in a database; it orchestrates the following:

  1. Node Selection: Our balancer identifies the high-performance node with the lowest latency and highest availability for your region.
  2. Instance Isolation: A dedicated, isolated environment is carved out for your session, ensuring that your data and encryption keys never mingle with other users.
  3. Identifier Assignment: You are issued a unique instance_id, which serves as your permanent handle for all future interactions with that specific WhatsApp account.

🛡️ Strategic Best Practices

1. Data Integrity and Persistence

Always save the returned instance_id and server_name in your local database immediately.

  • The "Context Store": Associate this ID with your internal User IDs or Business IDs.
  • Troubleshooting: If you ever need to contact support, providing the server_name allows our engineers to pinpoint the exact infrastructure node hosting your session, reducing resolution time from hours to minutes.

2. Idempotency and Deduplication

Before calling create, always check your own system state.

  • The Trap: Re-creating instances every time a user refreshes their settings page will quickly exhaust your quota.
  • The Solution: Implement a "Check-then-Create" logic. Only call this endpoint if your database shows that the user has no existing instance_id or if they have explicitly requested to "Delete and Start New."

3. "Lazy" Provisioning

Don't create sessions in bulk. Provision an instance only when a user is actively "Onboarding." This maintains a clean environment and ensures that your allocated resources are being used by active, paying, or engaged customers.


💡 Industry-Standard Use Cases

A. Customer Relationship Management (CRM)

Automatically provision a unique WhatsApp instance for every new high-value account. This allows your sales team to have dedicated communication channels that are fully logged and auditable within your CRM.

B. Automated Appointment Reminders

For medical or service industries, use this endpoint to spin up "Notification Engines." By separating "Notifications" from "Customer Support" across different instances, you reduce the risk of account flagging and ensure high delivery rates.

C. Multi-Tenant SaaS Platforms

If you build software for other businesses, you can use this endpoint to offer "WhatsApp-as-a-Service" to your clients. Each of your clients gets their own instance_id, giving them a private, secure connection to their own customers.


⚠️ Common Pitfalls and Troubleshooting

"quota_reached" (403 Forbidden)

This is the most common error for growing applications. It means you have used all the "slots" provided by your current plan.

  • Fix: Either upgrade your plan or use the /v2/session/delete endpoint to remove stagnant or unused sessions.

"missing_param" (400 Bad Request)

The "Factory" cannot verify your identity without the access_token.

  • Fix: Ensure your token is included in the request body (POST). Double-check for trailing spaces or hidden characters if copying from a dashboard.

🚀 The Next Step: "The Warm Boot"

Creating a session is like "registering a car." You now have the keys, but the engine isn't running yet. Your newly created session will be in the STOPPED state. To actually start the authentication process and generate a QR code, you must call the /v2/session/start endpoint immediately after success.

Request Parameters

Configure the parameters required to interact with this endpoint. All query and body arguments are listed below with their details.

Request Body

Sent as a JSON object
string

Your API Access Token

Example:

Request Samples

Use these ready-to-go code snippets to integrate our API into your project quickly and efficiently. Choose your preferred language and library.

1const baseUrl = "https://api.wawp.net";
2const endpoint = "/v2/session/create";
3const params = new URLSearchParams({
4 "access_token": "YOUR_ACCESS_TOKEN"
5}).toString();
6
7
8fetch(`${baseUrl}${endpoint}${params ? '?' + params : ''}`, {
9 method: "POST",
10 headers: { "Content-Type": "application/json" },
11
12})
13 .then(async (response) => {
14 if (response.ok) {
15 const data = await response.json();
16 console.log("Success:", data);
17 return data;
18 }
19
20 // Error Handling
21 if (response.status === 400) {
22 console.error("Error 400: Bad Request - Missing Token");
23 }
24 if (response.status === 401) {
25 console.error("Error 401: Unauthorized - Invalid or Missing Access Token");
26 }
27 if (response.status === 403) {
28 console.error("Error 403: Forbidden - Quota or Limit Reached");
29 }
30 if (response.status === 500) {
31 console.error("Error 500: Internal Server Error - Unexpected Failure");
32 }
33
34 const errorText = await response.text();
35 console.error(`Error ${response.status}: ${errorText}`);
36 })
37 .catch((error) => console.error("Network Error:", error));
Interactive Samples
Ln 37, Col 1javascript

Expected Responses

Explore all possible responses and outcomes from the server. We have documented each status code with data examples to make success and error handling easier.

Success - Session Created
Bad Request - Missing Token
Unauthorized - Invalid or Missing Access Token
Forbidden - Quota or Limit Reached
Internal Server Error - Unexpected Failure
Previous TopicSession Lifecycle
Next TopicStart Session

Command Palette

Search for a command to run...