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

# Companies API

> Company management endpoints

# Companies API

Manage company profiles, search, and verification.

## Endpoints

| Method | Path                      | Description               |
| ------ | ------------------------- | ------------------------- |
| GET    | `/companies`              | List companies            |
| GET    | `/companies/search`       | Full-text search          |
| GET    | `/companies/{slug}`       | Get by slug               |
| GET    | `/companies/{id}`         | Get by ID                 |
| POST   | `/companies`              | Create company            |
| PATCH  | `/companies/{id}`         | Update company            |
| DELETE | `/companies/{id}`         | Delete company            |
| POST   | `/companies/check-domain` | Check domain availability |

## List Companies

```bash theme={null}
GET /companies
```

### Query Parameters

| Parameter | Type   | Description                  |
| --------- | ------ | ---------------------------- |
| page      | int    | Page number (default: 1)     |
| limit     | int    | Items per page (default: 20) |
| category  | string | Filter by category           |
| city      | string | Filter by city               |
| verified  | bool   | Filter verified only         |

### Response

```json theme={null}
{
  "data": [
    {
      "id": "uuid",
      "name": "Acme Corp",
      "slug": "acme-corp",
      "category": "Manufacturing",
      "city": "Mumbai",
      "verified": true
    }
  ],
  "total": 100,
  "page": 1,
  "limit": 20
}
```

## Search Companies

Full-text search using PostgreSQL tsvector.

```bash theme={null}
GET /companies/search?q=jewelry+kolkata
```

### Query Parameters

| Parameter | Type   | Description    |
| --------- | ------ | -------------- |
| q         | string | Search query   |
| page      | int    | Page number    |
| limit     | int    | Items per page |

## Get by Slug

```bash theme={null}
GET /companies/acme-corp
```

## Create Company

```bash theme={null}
POST /companies
```

### Request Body

```json theme={null}
{
  "name": "Acme Corp",
  "category": "Manufacturing",
  "sub_category": "Textiles",
  "address_line1": "123 Main St",
  "city": "Mumbai",
  "state": "Maharashtra",
  "country": "India",
  "pincode": "400001",
  "gstin": "27ABCDE1234F1Z5",
  "phone": "+91-9876543210"
}
```

## Update Company

```bash theme={null}
PATCH /companies/{id}
```

### Request Body

```json theme={null}
{
  "name": "Acme Corporation",
  "phone": "+91-9876543211"
}
```

## Check Domain Availability

```bash theme={null}
POST /companies/check-domain
```

### Request Body

```json theme={null}
{
  "domain": "acme.com"
}
```

### Response

```json theme={null}
{
  "available": false,
  "company": {
    "id": "uuid",
    "name": "Acme Corp"
  }
}
```
