Create session by user token
curl --request POST \
--url http://localhost:3000/v1/session/token/{token} \
--header 'Content-Type: application/json' \
--header 'X-Bunker-Token: <api-key>' \
--data '
{
"expiration": "3d",
"clientip": "<string>",
"x-forwarded-for": "<string>"
}
'import requests
url = "http://localhost:3000/v1/session/token/{token}"
payload = {
"expiration": "3d",
"clientip": "<string>",
"x-forwarded-for": "<string>"
}
headers = {
"X-Bunker-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Bunker-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({expiration: '3d', clientip: '<string>', 'x-forwarded-for': '<string>'})
};
fetch('http://localhost:3000/v1/session/token/{token}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/v1/session/token/{token}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'expiration' => '3d',
'clientip' => '<string>',
'x-forwarded-for' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Bunker-Token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:3000/v1/session/token/{token}"
payload := strings.NewReader("{\n \"expiration\": \"3d\",\n \"clientip\": \"<string>\",\n \"x-forwarded-for\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Bunker-Token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:3000/v1/session/token/{token}")
.header("X-Bunker-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"expiration\": \"3d\",\n \"clientip\": \"<string>\",\n \"x-forwarded-for\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/v1/session/token/{token}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["X-Bunker-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"expiration\": \"3d\",\n \"clientip\": \"<string>\",\n \"x-forwarded-for\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "ok",
"session": "7a77ffad-2010-4e47-abbe-bcd04509f784"
}{
"status": "error",
"message": "user with this email already exists"
}{
"status": "error",
"message": "missing X-Bunker-Token header"
}{
"status": "error",
"message": "user not found"
}Session
Create session by user token
Creates a new user session and returns a session token. Sessions can have an expiration TTL specified in the request.
POST
/
v1
/
session
/
token
/
{token}
Create session by user token
curl --request POST \
--url http://localhost:3000/v1/session/token/{token} \
--header 'Content-Type: application/json' \
--header 'X-Bunker-Token: <api-key>' \
--data '
{
"expiration": "3d",
"clientip": "<string>",
"x-forwarded-for": "<string>"
}
'import requests
url = "http://localhost:3000/v1/session/token/{token}"
payload = {
"expiration": "3d",
"clientip": "<string>",
"x-forwarded-for": "<string>"
}
headers = {
"X-Bunker-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Bunker-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({expiration: '3d', clientip: '<string>', 'x-forwarded-for': '<string>'})
};
fetch('http://localhost:3000/v1/session/token/{token}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/v1/session/token/{token}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'expiration' => '3d',
'clientip' => '<string>',
'x-forwarded-for' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Bunker-Token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:3000/v1/session/token/{token}"
payload := strings.NewReader("{\n \"expiration\": \"3d\",\n \"clientip\": \"<string>\",\n \"x-forwarded-for\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Bunker-Token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:3000/v1/session/token/{token}")
.header("X-Bunker-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"expiration\": \"3d\",\n \"clientip\": \"<string>\",\n \"x-forwarded-for\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/v1/session/token/{token}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["X-Bunker-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"expiration\": \"3d\",\n \"clientip\": \"<string>\",\n \"x-forwarded-for\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "ok",
"session": "7a77ffad-2010-4e47-abbe-bcd04509f784"
}{
"status": "error",
"message": "user with this email already exists"
}{
"status": "error",
"message": "missing X-Bunker-Token header"
}{
"status": "error",
"message": "user not found"
}Authorizations
Root access token for Databunker API
Path Parameters
User token (UUID)
Body
application/jsonapplication/x-www-form-urlencoded
⌘I