cURL
PHP
Node.js
Python
Go
Java
C#
C++
curl -X POST "https://api.veritakibi.com/v1/whatsapp/conversations/<id> /archive" \
-H "Authorization: Bearer <YOUR_API_KEY> "
// The key is read from an environment variable, never written into the code
$apiKey = getenv('VERITAKIBI_API_KEY' );
$ch = curl_init('https://api.veritakibi.com/v1/whatsapp/conversations/<id> /archive' );
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST' ,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
],
]);
$response = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
// Node 18+: built-in fetch; save as .mjs (import syntax)
// The key is read from an environment variable, never written into the code
const apiKey = process.env.VERITAKIBI_API_KEY;
const res = await fetch('https://api.veritakibi.com/v1/whatsapp/conversations/<id> /archive' , {
method: 'POST' ,
headers: {
'Authorization' : `Bearer ${apiKey}` ,
},
});
const response = await res.json();
const status = res.status;
# Python 3.6+: standard library only (urllib, json)
# The key is read from an environment variable, never written into the code
import json, os, urllib.request
api_key = os.environ['VERITAKIBI_API_KEY' ]
req = urllib.request.Request(
'https://api.veritakibi.com/v1/whatsapp/conversations/<id> /archive' ,
method='POST' ,
headers={
'Authorization' : f'Bearer {api_key}' ,
},
)
with urllib.request.urlopen(req) as res:
status = res.status
response = json.load(res)
// Go 1.18+: standard library only (net/http, encoding/json)
// The key is read from an environment variable, never written into the code
package main
import (
"encoding/json"
"net/http"
"os"
)
func main() {
apiKey := os.Getenv("VERITAKIBI_API_KEY" )
req, err := http.NewRequest("POST" , "https://api.veritakibi.com/v1/whatsapp/conversations/<id> /archive" , nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization" , "Bearer " +apiKey)
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
status := res.StatusCode
var response map[string]any
json.NewDecoder(res.Body).Decode(&response)
_, _ = status, response
}
// Java 11+: built-in java.net.http; file name Example.java
// The key is read from an environment variable, never written into the code
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
String apiKey = System.getenv("VERITAKIBI_API_KEY" );
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.veritakibi.com/v1/whatsapp/conversations/<id> /archive" ))
.header("Authorization" , "Bearer " + apiKey)
.method("POST" , HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> res = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
// JSON text; Java has no built-in JSON parser, use a JSON library
String response = res.body();
int status = res.statusCode();
}
}
// .NET 6+: top-level statements; default console template (implicit usings on)
// The key is read from an environment variable, never written into the code
using System.Net.Http.Headers;
using System.Text.Json;
var apiKey = Environment.GetEnvironmentVariable("VERITAKIBI_API_KEY" );
using var http = new HttpClient();
var request = new HttpRequestMessage(new HttpMethod("POST" ), "https://api.veritakibi.com/v1/whatsapp/conversations/<id> /archive" );
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer" , apiKey);
var res = await http.SendAsync(request);
var response = JsonDocument.Parse(await res.Content.ReadAsStringAsync());
var status = (int)res.StatusCode;
// C++11+: requires libcurl (link with -lcurl)
// The key is read from an environment variable, never written into the code
#include <curl/curl.h>
#include <cstdlib>
#include <string>
// Collects the response body into a string
static size_t write_body(char* data, size_t size, size_t nmemb, void* out) {
static_cast<std::string*>(out)->append(data, size * nmemb);
return size * nmemb;
}
int main() {
const char* api_key = std::getenv("VERITAKIBI_API_KEY" );
std::string auth = std::string("Authorization: Bearer " ) + (api_key ? api_key : "" );
std::string response;
long status = 0;
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL* ch = curl_easy_init();
curl_slist* headers = nullptr;
headers = curl_slist_append(headers, auth.c_str());
curl_easy_setopt(ch, CURLOPT_URL, "https://api.veritakibi.com/v1/whatsapp/conversations/<id> /archive" );
curl_easy_setopt(ch, CURLOPT_CUSTOMREQUEST, "POST" );
curl_easy_setopt(ch, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, write_body);
curl_easy_setopt(ch, CURLOPT_WRITEDATA, &response);
curl_easy_perform(ch);
curl_easy_getinfo(ch, CURLINFO_RESPONSE_CODE, &status);
curl_slist_free_all(headers);
curl_easy_cleanup(ch);
curl_global_cleanup();
}