Skip to main content
GET
/
connect
/
check
Check Service Connection
curl --request GET \
  --url https://auth.nullpass.xyz/api/connect/check \
  --header 'Authorization: Bearer <token>'
{
  "connected": true,
  "service": "DROP",
  "tier": "<string>",
  "isPremium": true
}

Endpoint

GET /api/connect/check

Overview

Checks the connection status for a specific service. Returns whether the service is connected and entitlement details.

Request

Requires authentication via Bearer token.

Query Parameters

service
ServiceIdentifier
required
Service identifier: DROP, MAILS, VAULT, or DB

Response

connected
boolean
Whether the service is connected
service
string
Service identifier
tier
string
Access tier (if entitlement exists)
isPremium
boolean
Premium access flag (if entitlement exists)

Implementation Details

Code Reference

export async function GET(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 { searchParams } = new URL(request.url)
    const service = searchParams.get('service') as 'DROP' | 'MAILS' | 'VAULT' | 'DB' | null

    if (!service) {
      return errorResponse('Service parameter is required', 400, request.headers.get('origin'))
    }

    if (!['DROP', 'MAILS', 'VAULT', 'DB'].includes(service)) {
      return errorResponse('Invalid service. Must be DROP, MAILS, VAULT, or DB', 400, request.headers.get('origin'))
    }

    const entitlement = await prisma.userServiceEntitlement.findUnique({
      where: {
        userId_service: {
          userId: auth.userId,
          service: service,
        },
      },
    })

    if (!entitlement) {
      return jsonResponse(
        {
          connected: false,
          service,
          message: 'No entitlement found for this service',
        },
        200,
        request.headers.get('origin')
      )
    }

    return jsonResponse(
      {
        connected: (entitlement as any).connected ?? true,
        service: entitlement.service,
        tier: entitlement.tier,
        isPremium: entitlement.isPremium,
      },
      200,
      request.headers.get('origin')
    )
  } catch (error) {
    logger.error('Check connection status error:', error)
    return errorResponse('Internal server error', 500, request.headers.get('origin'))
  }
}

Status Codes

200
OK
Success (even if no entitlement found)
400
Bad Request
Missing or invalid service parameter
401
Unauthorized
Missing or invalid authentication token

Example Request

curl -X GET "https://auth.nullpass.xyz/api/connect/check?service=DROP" \
  -H "Authorization: Bearer YOUR_TOKEN"

Example Response

Connected Service

{
  "connected": true,
  "service": "DROP",
  "tier": "premium",
  "isPremium": true
}

No Entitlement

{
  "connected": false,
  "service": "DROP",
  "message": "No entitlement found for this service"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

service
enum<string>
required
Available options:
DROP,
MAILS,
VAULT,
DB

Response

200 - application/json

Connection status

connected
boolean
service
enum<string>
Available options:
DROP,
MAILS,
VAULT,
DB
tier
string | null
isPremium
boolean | null