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

# Signup

> Register a new user or company using GNet Connect's signup API.

## Signup API Overview

The **Signup API** handles the registration of new users or companies in GNet Connect. This endpoint supports both **dry mode** and **live mode** for flexible registration workflows.

* **Dry Mode:** Simulates the registration process, providing a preview of the data without saving it to the database.
* **Live Mode:** Commits the registration data, creating the user or company record.

***

## **Endpoint**

`POST /api/company/register`

***

## **Request Body Schema**

```ts theme={null}
const SignupSchema = z.object({
  name: z.string().min(1).max(250),
  mainPhone: z.string(),
  countryCode: z.string(),
  mainEmail: z.string().email(),
  address: z.string().nullish(),
  coType: z.enum(["IO", "CO"]),
  vendor_platform: z.string().nullish(),
  password: z.string().min(8).max(100),
  confirmPassword: z.string().min(8).max(100),
  mode: z.enum(["dry", "live"]),
  notes: z.string().nullish(),
});
```

***

### **Required Fields**

| Field           | Type            | Description           | Validation                |
| --------------- | --------------- | --------------------- | ------------------------- |
| name            | string          | Company or full name  | Min 1, Max 250 characters |
| mainEmail       | string          | Primary email address | Must be a valid email     |
| mainPhone       | string          | Primary phone number  | Required                  |
| countryCode     | string          | Country code          | Required                  |
| coType          | "IO" or "CO"    | Company type          | Required                  |
| address         | string          | Company address       | Optional                  |
| mode            | "dry" or "live" | Registration mode     | Required                  |
| password        | string          | Password              | Min 8, Max 100 characters |
| confirmPassword | string          | Password confirmation | Must match `password`     |

***

### **Optional Fields**

| Field            | Type   | Description               | Validation |
| ---------------- | ------ | ------------------------- | ---------- |
| vendor\_platform | string | Vendor platform           | Optional   |
| notes            | string | How did you hear about us | Optional   |

***

## **Example Request Body**

```json theme={null}
{
  "name": "Company Name",
  "mainEmail": "email@example.com",
  "mainPhone": "+1234567890",
  "countryCode": "+1",
  "password": "securepassword",
  "confirmPassword": "securepassword",
  "address": "123 Main St, City, State",
  "notes": "Found through TranspoApp",
  "coType": "IO",
  "mode": "live"
}
```

***

## **Success Responses**

### **200 - Success**

Returned for both successful company registration and successful dry run validation.

**Standard Success Response:**

```json theme={null}
{
  "success": true,
  "status": 200,
  "error": ""
}
```

**Dry Run Success Response:**

```json theme={null}
{
  "success": true,
  "status": 200,
  "error": "",
  "verification": {
    // Verification score details
  },
  "mode": "dry",
  "griddid": "company-slug",
  "data": {
    // Submitted payload data
  }
}
```

***

## **Error Responses**

### **422 - Unprocessable Entity**

Occurs when the request payload fails schema validation.

```json theme={null}
{
  "success": false,
  "error": "Invalid payload"
}
```

### **428 - Precondition Required**

Returned when the AI verification score is below the required threshold.

```json theme={null}
{
  "success": false,
  "error": "Verification failed"
}
```

### **409 - Conflict**

Indicates that a user or company with the given email or phone already exists.

```json theme={null}
{
  "success": false,
  "status": 409,
  "error": "For given email or phone, we found at least one registered entity: {contextid}"
}
```

### **424 - Failed Dependency**

Occurs when an issue with dependent services or database operations prevents registration.

```json theme={null}
{
  "success": false,
  "status": 424,
  "error": "{specific error message}"
}
```

### **501 - Not Implemented**

Occurs when an invalid company type is provided or when an unimplemented registration path is used.

```json theme={null}
{
  "success": false
}
```

### **502 - Bad Gateway**

Returned for server-side errors during Independent Operator (IO) registration.

```json theme={null}
{
  "success": false,
  "status": 502,
  "error": "{error details}"
}
```

### **503 - Service Unavailable**

Returned for server-side errors during Company (CO) registration.

```json theme={null}
{
  "success": false,
  "status": 503,
  "error": "{error details}"
}
```

***

## **Response Format**

All responses follow a consistent structure:

| Field             | Type    | Description                               |
| ----------------- | ------- | ----------------------------------------- |
| success           | boolean | Indicates whether the operation succeeded |
| status            | number  | HTTP status code                          |
| error             | string  | Error message (if applicable)             |
| additional fields | varies  | Context-specific fields like `griddid`    |

***

## **Notes**

* Fields marked as `nullish` in the schema are optional.
* `password` and `confirmPassword` must match.
* The API automatically generates fields like `griddid` and `createdAt`.
* Default AI verification score threshold is 30.
* The payment object, if needed, is handled through separate endpoints.

***

## **Related Documentation**

* [User Check API](/connect-api/user-check)
* [Editing User/Company API](/connect-api/edit-company)

For additional details, please refer to the complete API documentation.
