MENU navbar-image

Introduction

This documentation aims to provide all the information you need to work with our API.

Authenticating requests

To authenticate requests, include an Authorization header with the value "Bearer {YOUR_AUTH_KEY}".

All authenticated endpoints are marked with a requires authentication badge in the documentation below.

You can retrieve your token by visiting your profile and clicking Generate API key.

Endpoints

Healthcheck

Check that the service is up. If everything is okay, you'll get a 200 OK response.

Otherwise, the request will fail with a 400 error, and a response listing the failed services.

Example request:
curl --request GET \
    --get "https://klik.social/api/healthcheck"
const url = new URL(
    "https://klik.social/api/healthcheck"
);

fetch(url, {
    method: "GET",
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://klik.social/api/healthcheck';
$response = $client->get($url);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
strict-transport-security: max-age=31536000; includeSubdomains
access-control-allow-origin: *
 

{
    "status": true
}
 

Example response (400, Service is unhealthy):


{
    "status": false
}
 

Request      

GET api/healthcheck

Response

Response Fields

status   boolean     

The status of this API (true or false).

Authenticate or provision a user by email (internal)

Example request:
curl --request POST \
    "https://klik.social/api/v1/auth-by-email" \
    --header "X-API-KEY: string required Internal API key." \
    --header "Content-Type: application/json" \
    --data "{
    \"email\": \"[email protected]\",
    \"name\": \"Jane Doe\",
    \"created_from\": \"external-project\"
}"
const url = new URL(
    "https://klik.social/api/v1/auth-by-email"
);

const headers = {
    "X-API-KEY": "string required Internal API key.",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "email": "[email protected]",
    "name": "Jane Doe",
    "created_from": "external-project"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://klik.social/api/v1/auth-by-email';
$response = $client->post(
    $url,
    [
        'headers' => [
            'X-API-KEY' => 'string required Internal API key.',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'email' => '[email protected]',
            'name' => 'Jane Doe',
            'created_from' => 'external-project',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200, success):


{
    "success": true,
    "data": {
        "token": "Your auth token",
        "user": {
            "id": 12,
            "name": "Jane Doe",
            "email": "[email protected]",
            "created_from": "external-project"
        }
    },
    "message": null
}
 

Example response (403, Invalid or missing X-API-KEY):


{
    "success": false,
    "errors": [
        "Request validation failed"
    ],
    "message": "Request validation failed"
}
 

Request      

POST api/v1/auth-by-email

Headers

X-API-KEY        

Example: string required Internal API key.

Content-Type        

Example: application/json

Body Parameters

email   string     

The user's email. Example: [email protected]

name   string     

The user's full name. Example: Jane Doe

created_from   string     

Source identifier for where the user was created from. Example: external-project

POST api/v1/official-device/send-message

requires authentication

Example request:
curl --request POST \
    "https://klik.social/api/v1/official-device/send-message" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --data "{
    \"mobile\": \"919999999999\",
    \"message\": \"Hello buddy\",
    \"image\": \"iVBORw0KGgoAAA...\"
}"
const url = new URL(
    "https://klik.social/api/v1/official-device/send-message"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "mobile": "919999999999",
    "message": "Hello buddy",
    "image": "iVBORw0KGgoAAA..."
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://klik.social/api/v1/official-device/send-message';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'mobile' => '919999999999',
            'message' => 'Hello buddy',
            'image' => 'iVBORw0KGgoAAA...',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200, success):


{
    "success": true,
    "data": null,
    "message": "Message sent successfully."
}
 

Example response (200, failed):


{
    "success": false,
    "errors": [],
    "message": "Session is not logged in."
}
 

Request      

POST api/v1/official-device/send-message

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Body Parameters

mobile   numbers     

The mobile number to send message with country code. Example: 919999999999

message   string     

The message string. Example: Hello buddy

image   string     

The image should be base64 string without mime prefix. Example: iVBORw0KGgoAAA...

POST api/v1/official-device/send-file

requires authentication

Example request:
curl --request POST \
    "https://klik.social/api/v1/official-device/send-file" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --data "{
    \"mobile\": \"919999999999\",
    \"file\": \"iVBORw0KGgoAAA...\"
}"
const url = new URL(
    "https://klik.social/api/v1/official-device/send-file"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "mobile": "919999999999",
    "file": "iVBORw0KGgoAAA..."
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://klik.social/api/v1/official-device/send-file';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'mobile' => '919999999999',
            'file' => 'iVBORw0KGgoAAA...',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200, success):


{
    "success": true,
    "data": null,
    "message": "File sent successfully."
}
 

Example response (200, failed):


{
    "success": false,
    "errors": [],
    "message": "Session is not logged in."
}
 

Request      

POST api/v1/official-device/send-file

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

Body Parameters

mobile   numbers     

The mobile number to send message with country code. Example: 919999999999

file   string     

The file should be base64 string without mime prefix. Example: iVBORw0KGgoAAA...

Get official device connection status

requires authentication

Example request:
curl --request GET \
    --get "https://klik.social/api/v1/official-device/status" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}"
const url = new URL(
    "https://klik.social/api/v1/official-device/status"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://klik.social/api/v1/official-device/status';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200, success):


{
  "success": true,
  "data": {
    "is_connected": true,
    "session": {
      "uuid": "ffd7f83e-06c3-47c8-a6a1-dd943da13b5f",
      "mobile": "919999999999"
    },
    "user": {
      "id": 12,
      "name": "Jane Doe",
      "email": "[email protected]"
    }
  },
}
 

Request      

GET api/v1/official-device/status

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

POST api/v1/{session_uuid}/send-message

requires authentication

Example request:
curl --request POST \
    "https://klik.social/api/v1/ffd7f83e-06c3-47c8-a6a1-dd943da13b5f/send-message" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --data "{
    \"mobile\": \"919999999999\",
    \"message\": \"Hello buddy\",
    \"image\": \"iVBORw0KGgoAAA...\"
}"
const url = new URL(
    "https://klik.social/api/v1/ffd7f83e-06c3-47c8-a6a1-dd943da13b5f/send-message"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "mobile": "919999999999",
    "message": "Hello buddy",
    "image": "iVBORw0KGgoAAA..."
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://klik.social/api/v1/ffd7f83e-06c3-47c8-a6a1-dd943da13b5f/send-message';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'mobile' => '919999999999',
            'message' => 'Hello buddy',
            'image' => 'iVBORw0KGgoAAA...',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200, success):


{
    "success": true,
    "data": null,
    "message": "Message sent successfully."
}
 

Example response (200, failed):


{
    "success": false,
    "errors": [],
    "message": "Session is not logged in."
}
 

Request      

POST api/v1/{session_uuid}/send-message

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

URL Parameters

session_uuid   string     

The session from your dashboard. Example: ffd7f83e-06c3-47c8-a6a1-dd943da13b5f

Body Parameters

mobile   numbers     

The mobile number to send message with country code. Example: 919999999999

message   string     

The message string. Example: Hello buddy

image   string     

The image should be base64 string without mime prefix. Example: iVBORw0KGgoAAA...

POST api/v1/{session_uuid}/send-file

requires authentication

Example request:
curl --request POST \
    "https://klik.social/api/v1/ffd7f83e-06c3-47c8-a6a1-dd943da13b5f/send-file" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --data "{
    \"mobile\": \"919999999999\",
    \"file\": \"iVBORw0KGgoAAA...\"
}"
const url = new URL(
    "https://klik.social/api/v1/ffd7f83e-06c3-47c8-a6a1-dd943da13b5f/send-file"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "mobile": "919999999999",
    "file": "iVBORw0KGgoAAA..."
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://klik.social/api/v1/ffd7f83e-06c3-47c8-a6a1-dd943da13b5f/send-file';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
        ],
        'json' => [
            'mobile' => '919999999999',
            'file' => 'iVBORw0KGgoAAA...',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200, success):


{
    "success": true,
    "data": null,
    "message": "File sent successfully."
}
 

Example response (200, failed):


{
    "success": false,
    "errors": [],
    "message": "Session is not logged in."
}
 

Request      

POST api/v1/{session_uuid}/send-file

Headers

Authorization        

Example: Bearer {YOUR_AUTH_KEY}

Content-Type        

Example: application/json

URL Parameters

session_uuid   string     

The session from your dashboard. Example: ffd7f83e-06c3-47c8-a6a1-dd943da13b5f

Body Parameters

mobile   numbers     

The mobile number to send message with country code. Example: 919999999999

file   string     

The file should be base64 string without mime prefix. Example: iVBORw0KGgoAAA...