# Add New Estimates

`POST /api/estimates`



- **Group:** Estimates
- **Since:** v0.3.0
- **Authentication:** `authtoken` header, created under Setup > API > API Management
- **HTML version:** /apiguide/estimates/post-estimates/

## Headers

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `authtoken` | String | **required** | Authentication token, generated from admin area |

## Parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `clientid` | Number | **required** | Mandatory. Customer id |
| `number` | Number | **required** | Mandatory. Estimates Number |
| `date` | Date | **required** | Mandatory. Estimates Date |
| `duedate` | Date | optional | Optional. Expiry Date of Estimates |
| `currency` | Number | **required** | Mandatory. currency field |
| `newitems` | Array | **required** | Mandatory. New Items to be added |
| `subtotal` | Decimal | **required** | Mandatory. calculation based on item Qty, Rate and Tax |
| `total` | Decimal | **required** | Mandatory. calculation based on subtotal, Discount and Adjustment |
| `billing_street` | String | **required** | Optional. Street Address |
| `billing_city` | String | optional | Optional. City Name for billing |
| `billing_state` | String | optional | Optional. Name of state for billing |
| `billing_zip` | Number | optional | Optional. Zip code |
| `billing_country` | Number | optional | Optional. Country code |
| `shipping_street` | String | optional | Optional. Address of shipping |
| `shipping_city` | String | optional | Optional. City name for shipping |
| `shipping_state` | String | optional | Optional. Name of state for shipping |
| `shipping_zip` | Number | optional | Optional. Zip code for shipping |
| `shipping_country` | Number | optional | Optional. Country code |
| `tags` | String | optional | Optional. TAGS comma separated |
| `status` | Number | optional | Optional. Status id (default status is Accepted) |
| `Reference` | String | optional | Optional. Reference name |
| `sale_agent` | Number | optional | Optional. Sale Agent name |
| `adminnote` | String | optional | Optional. notes by admin |
| `clientnote` | String | optional | Optional. client notes |
| `terms` | String | optional | Optional. Terms |

## Example request

```bash
curl -X POST "https://yoursite.com/api/estimates" \
  -H "authtoken: YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "clientid": "...", "number": "...", "date": "...", "currency": "...", "newitems": "...", "subtotal": "...", "total": "...", "billing_street": "..." }'
```

## Success response

### Success-Response:

```json
HTTP/1.1 200 OK
{
  "status": true,
  "message": "Estimates Added Successfully"
}
```

## Error responses

### Error-Response:

```json
HTTP/1.1 404 Not Found
{
  "status": false,
  "message": "Estimates Add Fail"
}
```

### Error-Response:

```json
    HTTP/1.1 409 Conflict
    {
      "status": false,
      "error": {
			"number":"The Estimates number is already in use"
		},
		"message": "The Estimates number is already in use"
    }
```

### Error-Response:

```json
  HTTP/1.1 404 Not Found
   {
	    "status": false,
	    "error": {
	        "newitems[]": "The Items field is required"
	    },
	    "message": "<p>The Items field is required</p>\n"
	}
```

### Error-Response:

```json
  HTTP/1.1 404 Not Found
   {
	    "status": false,
	    "error": {
	        "subtotal": "The Sub Total field is required"
	    },
	    "message": "<p>The Sub Total field is required</p>\n"
	}
```

### Error-Response:

```json
  HTTP/1.1 404 Not Found
   {
	    "status": false,
	    "error": {
	        "total": "The Total field is required"
	    },
	    "message": "<p>The Total field is required</p>\n"
	}
```

---

Perfex CRM REST API by Themesic Interactive. Full reference: /apiguide/
