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

# User Check

> Check if a user or company exists using various identifiers.

## User Check API

The **User Check API** allows you to verify if a user or company already exists in the GNet Connect system using identifiers such as `username`, `email`, `griddid` (unique GNET ID), or `phone`. This ensures data integrity by preventing duplicate records during registration.

***

### **Endpoint**

`GET /api/user/check`

***

### **Query Parameters**

| Parameter | Type   | Description                               | Required |
| --------- | ------ | ----------------------------------------- | -------- |
| username  | string | Username to search for existing users     | No       |
| email     | string | Email address to check for existing users | No       |
| phone     | string | Phone number to search for existing users | No       |

You can pass one or multiple query parameters in the same request. If multiple parameters are provided, the API will search and return results for each.

***

### **Example Request**

#### Request URL:

```bash theme={null}
GET /api/user/check?email=user@example.com&phone=+1234567890
```

***

### **Response**

The response will indicate whether each queried identifier was found, along with any related data.

#### **Example Response**

```json theme={null}
{
  "success": true,
  "username": {
    "query": "user123",
    "found": true,
    "result": {
      "id": "12345",
      "email": "user123@example.com",
      "name": "John Doe"
    }
  },
  "email": {
    "query": "user@example.com",
    "found": true,
    "result": {
      "id": "56789",
      "name": "Jane Smith"
    }
  },
  "griddid": {
    "query": "company-slug",
    "found": false,
    "result": null
  },
  "phone": {
    "query": "+1234567890",
    "found": true,
    "result": {
      "company": "ABC Corp",
      "contact": "Main Contact"
    }
  }
}
```

***

### **Success Response**

| Status | Description                                     |
| ------ | ----------------------------------------------- |
| 200    | Request processed successfully, returns results |

#### Response Fields

| Field    | Type    | Description                                |
| -------- | ------- | ------------------------------------------ |
| success  | boolean | Indicates if the operation was successful  |
| username | object  | Result of username search, if provided     |
| email    | object  | Result of email search, if provided        |
| griddid  | object  | Result of GNET ID search, if provided      |
| phone    | object  | Result of phone number search, if provided |

***

### **Error Responses**

| Status | Description           | Possible Causes                          |
| ------ | --------------------- | ---------------------------------------- |
| 400    | Bad request           | Invalid or missing query parameters      |
| 500    | Internal server error | Server-side error during data processing |

#### Example Error Response

```json theme={null}
{
  "success": false,
  "status": 500,
  "error": "Internal server error"
}
```

***

### **Best Practices**

* **Before registering new users**, always call this API to check for duplicates based on key identifiers.
* **Use multiple parameters** when possible to reduce false positives (e.g., searching by both email and phone).
* **Handle 400 and 500 status codes gracefully** to ensure a smooth user experience.

Ready to integrate this? Check out the [Signup API](/connect-api/sign-up) to learn how to register new users or companies once validation is complete.
