> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nullpass.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Check Service Connection

> Check service connection status

## 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

<ParamField query="service" type="ServiceIdentifier" required>
  Service identifier: `DROP`, `MAILS`, `VAULT`, or `DB`
</ParamField>

## Response

<ResponseField name="connected" type="boolean">
  Whether the service is connected
</ResponseField>

<ResponseField name="service" type="string">
  Service identifier
</ResponseField>

<ResponseField name="tier" type="string">
  Access tier (if entitlement exists)
</ResponseField>

<ResponseField name="isPremium" type="boolean">
  Premium access flag (if entitlement exists)
</ResponseField>

## Implementation Details

### Code Reference

```8:65:nullpass_clean/src/app/api/connect/check/route.ts theme={null}
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

<ResponseField name="200" type="OK">
  Success (even if no entitlement found)
</ResponseField>

<ResponseField name="400" type="Bad Request">
  Missing or invalid service parameter
</ResponseField>

<ResponseField name="401" type="Unauthorized">
  Missing or invalid authentication token
</ResponseField>

## Example Request

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

## Example Response

### Connected Service

```json theme={null}
{
  "connected": true,
  "service": "DROP",
  "tier": "premium",
  "isPremium": true
}
```

### No Entitlement

```json theme={null}
{
  "connected": false,
  "service": "DROP",
  "message": "No entitlement found for this service"
}
```


## OpenAPI

````yaml GET /connect/check
openapi: 3.1.0
info:
  title: Null Pass API
  description: >-
    Internal API documentation for Null Pass authentication and service
    management system
  version: 1.0.0
servers:
  - url: https://auth.nullpass.xyz/api
security: []
paths:
  /connect/check:
    get:
      tags:
        - Services
      summary: Check Service Connection
      description: Check connection status for a service
      parameters:
        - name: service
          in: query
          required: true
          schema:
            type: string
            enum:
              - DROP
              - MAILS
              - VAULT
              - DB
      responses:
        '200':
          description: Connection status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectionStatus'
      security:
        - bearerAuth: []
components:
  schemas:
    ConnectionStatus:
      type: object
      properties:
        connected:
          type: boolean
        service:
          type: string
          enum:
            - DROP
            - MAILS
            - VAULT
            - DB
        tier:
          type: string
          nullable: true
        isPremium:
          type: boolean
          nullable: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````