# Update a Expense

`PUT /api/expenses`



- **Group:** Expenses
- **Since:** v0.3.0
- **Authentication:** `authtoken` header, created under Setup > API > API Management
- **HTML version:** /apiguide/expenses/put-expense/

## Headers

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

## Parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `expense_name` | String | optional | Optional. Name |
| `note` | String | optional | Optional. Note |
| `category` | Number | **required** | Mandatory. Expense Category |
| `amount` | Decimal | **required** | Mandatory. Expense Amount |
| `date` | Date | **required** | Mandatory. Expense Date |
| `clientid` | Number | **required** | Optional. Customer id |
| `currency` | Number | **required** | Mandatory. currency field |
| `tax` | Number | **required** | Optional. Tax 1 |
| `tax2` | Number | **required** | Optional. Tax 2 |
| `paymentmode` | Number | **required** | Optional. Payment mode |
| `reference_no` | String | optional | Optional. Reference # |
| `recurring` | String | optional | Optional. recurring 1 to 12 or custom |
| `repeat_every_custom` | Number | optional | Optional. if recurring is custom set number gap |
| `repeat_type_custom` | String | optional | Optional. if recurring is custom set gap option day/week/month/year |

## Example request

```bash
curl -X PUT "https://yoursite.com/api/expenses" \
  -H "authtoken: YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "category": "...", "amount": "...", "date": "...", "clientid": "...", "currency": "...", "tax": "...", "tax2": "...", "paymentmode": "..." }'
```

## Success response

### Success-Response:

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

## Error responses

### Error-Response:

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

### Error-Response:

```json
HTTP/1.1 409 Conflict
{
  "status": false,
  "error": {
     "category":"The Expense Category is not found"
 },
 "message": "The Expense Category is not found"
}
```

### Error-Response:

```json
HTTP/1.1 409 Conflict
{
  "status": false,
  "error": {
     "date":"The Expense date field is required."
 },
 "message": "The Expense date field is required."
}
```

### Error-Response:

```json
HTTP/1.1 409 Conflict
{
  "status": false,
  "error": {
     "amount":"The Amount field is required."
 },
 "message": "The Amount field is required."
}
```

---

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