Service Connection
Disconnect Service
Disconnect from a service
POST
/
connect
/
disconnect
Disconnect Service
curl --request POST \
--url https://auth.nullpass.xyz/api/connect/disconnect \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'import requests
url = "https://auth.nullpass.xyz/api/connect/disconnect"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://auth.nullpass.xyz/api/connect/disconnect', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://auth.nullpass.xyz/api/connect/disconnect",
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([
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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 := "https://auth.nullpass.xyz/api/connect/disconnect"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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("https://auth.nullpass.xyz/api/connect/disconnect")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://auth.nullpass.xyz/api/connect/disconnect")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_bodyEndpoint
POST /api/connect/disconnect
Overview
Disconnects the authenticated user from a service by setting theconnected flag to false. The service entitlement remains but is marked as disconnected.
Request
ServiceIdentifier
required
Service identifier:
DROP, MAILS, VAULT, or DBResponse
boolean
Always
false on successstring
Service identifier
string
Access tier
boolean
Premium access flag
string
“Successfully disconnected from service”
Implementation Details
Code Reference
export async function POST(request: NextRequest) {
const corsResponse = handleCors(request)
if (corsResponse) return corsResponse
const blocked = await protectRoute(request)
if (blocked) return blocked
const auth = await requireAuth(request)
if ('error' in auth) return auth.error
try {
const body = await request.json()
const validated = disconnectSchema.parse(body)
logger.ups('Service disconnect request:', auth.userId, validated.service)
const existingEntitlement = await prisma.userServiceEntitlement.findUnique({
where: {
userId_service: {
userId: auth.userId,
service: validated.service,
},
},
})
if (!existingEntitlement) {
return errorResponse(
'Service entitlement not found. Please ensure you have access to this service.',
404,
request.headers.get('origin')
)
}
if (!(existingEntitlement as any).connected) {
return jsonResponse(
{
connected: false,
service: validated.service,
message: 'Already disconnected from this service',
},
200,
request.headers.get('origin')
)
}
const entitlement = await prisma.userServiceEntitlement.update({
where: {
userId_service: {
userId: auth.userId,
service: validated.service,
},
},
data: {
connected: false,
updatedAt: new Date(),
} as any,
})
await createAuditLog(auth.userId, 'SERVICE_ENTITLEMENT_DISCONNECT', {
service: validated.service,
})
logger.info('Service disconnected:', auth.userId, validated.service)
return jsonResponse(
{
connected: false,
service: entitlement.service,
tier: entitlement.tier,
isPremium: entitlement.isPremium,
message: 'Successfully disconnected from service',
},
200,
request.headers.get('origin')
)
} catch (error: any) {
if (error.name === 'ZodError') {
logger.warn('Disconnect service validation error:', error.errors)
return errorResponse(error.errors[0].message, 400, request.headers.get('origin'))
}
logger.error('Disconnect service error:', error)
return errorResponse('Internal server error', 500, request.headers.get('origin'))
}
}
Status Codes
OK
Successfully disconnected or already disconnected
Bad Request
Validation error
Unauthorized
Missing or invalid authentication token
Not Found
Service entitlement not found
Example Request
curl -X POST https://auth.nullpass.xyz/api/connect/disconnect \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"service": "DROP"
}'
Example Response
{
"connected": false,
"service": "DROP",
"tier": "premium",
"isPremium": true,
"message": "Successfully disconnected from service"
}
Audit Events
- SERVICE_ENTITLEMENT_DISCONNECT: Service disconnected successfully
⌘I
Disconnect Service
curl --request POST \
--url https://auth.nullpass.xyz/api/connect/disconnect \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'import requests
url = "https://auth.nullpass.xyz/api/connect/disconnect"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://auth.nullpass.xyz/api/connect/disconnect', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://auth.nullpass.xyz/api/connect/disconnect",
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([
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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 := "https://auth.nullpass.xyz/api/connect/disconnect"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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("https://auth.nullpass.xyz/api/connect/disconnect")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://auth.nullpass.xyz/api/connect/disconnect")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body