# Create a project

`POST https://rebaar.in/api/v1/projects/create`

Starts a project in Planning. Subject to the plan's project limit (402 `limit_reached`). Optional `pincode`, `stateCode` and `district` are the SITE's: the PIN fills the state and district when they are not sent, a state the PIN rules out is 400 with `field: "pincode"`, and an invoice suggests the site's state as its place of supply.

## Headers

| Header | Value |
|---|---|
| `Authorization` | `Bearer <your API key>` |
| `Content-Type` | `application/json` |

## Request body

| Field | Type | Required | Description |
|---|---|---|---|
| `name` | string | yes |  |
| `type` | string | yes | one of "Residential", "Commercial", "Interior", "Renovation" |
| `city` | string | no |  |
| `address` | string | no |  |
| `pincode` | string | no | 6-digit PIN code. The server fills stateCode and district from it when they are not sent.. pattern ^[1-9][0-9]{5}$ |
| `district` | string | no | at most 80 characters |
| `stateCode` | string | no | 2-digit GST state code, e.g. "29" (Karnataka). 400 with field "pincode" when the PIN is not in that state.. pattern ^[0-9]{2}$ |
| `value` | integer | no | Estimated project value in PAISE (rupees × 100). ₹1,500.00 = 150000. |
| `clientId` | string | no | A client of your company. |
| `startDate` | string (date) | no | Start date as an ISO YYYY-MM-DD string. |
| `endDate` | string (date) | no | End date as an ISO YYYY-MM-DD string. |

## Example

```bash
curl -X POST 'https://rebaar.in/api/v1/projects/create' \
  -H 'Authorization: Bearer ck_live_xxxxxxxx_…' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "Casa Verde",
  "type": "Residential",
  "clientId": "7d3f1c2a-5b8e-4f0a-9c61-2e4b7a9d0c13",
  "value": 875000000,
  "city": "Bengaluru",
  "pincode": "560076",
  "address": "14, 2nd Cross, JP Nagar 7th Phase",
  "startDate": "2026-08-01",
  "endDate": "2027-03-31"
}'
```

## Responses

### 201

Created. The new project's id (made from its name).

```json
{
  "id": "casa-verde"
}
```

### 400

Validation failed. `error` is the first problem found; `field` names it when it is a location, GSTIN, email or delivery-address field.

```json
{
  "error": "Invalid enum value. Expected 'Residential' | 'Commercial' | 'Interior' | 'Renovation', received 'House'"
}
```

### 401

No `Authorization: Bearer …` header was sent. Or: The key is unknown, revoked or expired — or the company cannot use it.

`unauthenticated` — No `Authorization: Bearer …` header was sent.

```json
{
  "error": "unauthenticated",
  "message": "Authorization: Bearer <api_key> required"
}
```

`invalid_token` — The key is unknown, revoked or expired — or the company cannot use it.

```json
{
  "error": "invalid_token",
  "message": "API key not recognised, revoked, or expired"
}
```

### 402

Over the plan's project limit; with a sandbox key, the practice company already holds 10,000 projects (`sandbox_limit`); or the plan / subscription does not allow the API.

`limit_reached`

```json
{
  "error": "limit_reached",
  "message": "Plan Growth is capped at 25 projects.",
  "used": 25,
  "limit": 25
}
```

`sandbox_limit`

```json
{
  "error": "sandbox_limit",
  "message": "The sandbox holds at most 10,000 projects. Reset the sandbox in Settings → API keys.",
  "resource": "projects",
  "used": 10000,
  "limit": 10000
}
```

`plan_required`

```json
{
  "error": "plan_required",
  "message": "API access requires the Scale plan. This workspace is on Growth.",
  "currentPlan": "growth",
  "requiredPlan": "scale"
}
```

`access_expired`

```json
{
  "error": "access_expired",
  "reason": "payment_failed",
  "message": "Workspace does not currently have an active Scale subscription."
}
```

### 403

The request came from an IP address that is not on the key's allowlist. Or: The key does not carry the scope this method needs: `read` for GET, `write` for POST, PATCH and DELETE.

`ip_not_allowed` — The request came from an IP address that is not on the key's allowlist.

```json
{
  "error": "ip_not_allowed",
  "message": "Source IP 203.0.113.7 is not on the key's allowlist."
}
```

`insufficient_scope` — The key does not carry the scope this method needs: `read` for GET, `write` for POST, PATCH and DELETE.

```json
{
  "error": "insufficient_scope",
  "message": "This API key does not have the 'write' scope.",
  "required": "write",
  "granted": [
    "read"
  ]
}
```

### 404

`clientId` is not a client of your company.

```json
{
  "error": "client_not_found"
}
```

### 429

More than 120 requests in a minute with this key (30 with a sandbox key).

`rate_limited` — More than 120 requests in a minute with this key (30 with a sandbox key).

```json
{
  "error": "Too many requests. Please try again later."
}
```

### 500

Something failed on our side.

`internal` — Something failed on our side.

```json
{
  "error": "internal"
}
```

## Errors every call can return

| Status | Code | Meaning | What to do |
|---|---|---|---|
| 401 | `unauthenticated` | No `Authorization: Bearer …` header was sent. | Send your API key as `Authorization: Bearer ck_live_…` on every request. |
| 401 | `invalid_token` | The key is unknown, revoked or expired — or the company cannot use it. | Check you copied the whole key. Make a new one in Settings → API keys if it was revoked or has expired. |
| 403 | `ip_not_allowed` | The request came from an IP address that is not on the key's allowlist. | Call from an allowed address, or change the key's IP allowlist in Settings → API keys. |
| 402 | `plan_required` | The company is not on the Scale plan, which includes the API. | The Owner moves the company to Scale in Settings → Billing. |
| 402 | `access_expired` | The subscription is not active (trial over, payment failed, cancelled, paused, locked or closing). `reason` says which. | The Owner pays or renews in Settings → Billing; calls work again at once. |
| 429 | — | More than 120 requests in a minute with this key (30 with a sandbox key). | Wait the number of seconds in the `Retry-After` header. Every reply carries `RateLimit-Remaining`, so you can slow down before this happens. |
| 403 | `insufficient_scope` | The key does not carry the scope this method needs: `read` for GET, `write` for POST, PATCH and DELETE. | Make a key with the scope you need in Settings → API keys. |
| 500 | `internal` | Something failed on our side. | Retry with exponential backoff. If it keeps happening, email support@rebaar.in with the time of the call. |
