Estimates

Estimates serve as proposals or quotes to be sent to Clients.

There is no separate API for individual estimate items.

Get All Estimates

GET /api/v2/estimates
{
  "page_count": 3
  "page_size": 30
  "total_count": 61
  "estimates": [
    {
      "tax": 5
      "number": "184"
      "total_cost": 129.15
      "subtotal": 123
      "title": ""
      "tax_label": "Sales Tax"
      "compound_tax": true
      "id": 110
      "date": "2011/07/26"
      "client_id": 4
      "note": ""
      "estimate_items": [
        {
          "price": 123
          "title": "Estimate Item"
          "quantity": 1
          "taxable": true
          ""id"": 184
        },
        ...
      ]
      "tax2_label": "Secondary Tax"
      "summary": null
      "tax2": 0
      "status": 0
      "currency_code": "EUR"
      "tax3_label": "Tertiary Tax"
      "tax3": 0
    },
    ...
  ]
}

Estimate Status Values:
0: Draft
1: Sent
2: Viewed
3: Cancelled
4: Declined
5: Revised
6: Accepted
7: Archived

GET /api/v2/estimates?page=2

On a bulk GET Clientary will return 30 results at once. To paginate through more results, you can use the page parameter.

GET /api/v2/clients/:client_id/estimates

You can also fetch estimates under a specific client.

GET /api/v2/projects/:project_id/estimates

Similarly, project specific estimates can be retrieved by scoping by project_id.

Get An Estimate

GET /api/v2/estimates/:id
{
  "tax": 5
  "number": "184"
  "total_cost": 129.15
  "subtotal": 123
  "title": ""
  "tax_label": "Sales Tax"
  "compound_tax": true
  "id": 110
  "date": "2011/07/26"
  "client_id": 4
  "note": ""
  "estimate_items": [
    {
      "price": 123
      "title": "Estimate Item"
      "quantity": 1
      "taxable": true
      "id": 184
    },
    ...
  ]
  "tax2_label": "Secondary Tax"
  "summary": null
  "tax2": 0
  "status": 0
  "currency_code": "EUR"
  "tax3_label": "Tertiary Tax"
  "tax3": 0
}

Create A New Estimate

POST /api/v2/estimates
{
  "estimate": {
    "number": 185, 
    "date": "2011-07-29", 
    "currency_code": "USD", 
    "estimate_items_attributes": [
      {
        "title": "foo", 
        "quantity": 1, 
        "price": 100
      }, 
      {
        "title": "bar", 
        "quantity": 2, 
        "price": 200
      }
    ]
  }
}

Required Fields: date, currency_code (HTTP 422 on failure)
Optional Fields: number will be autoincremented from previous invoice numbers if not provided
Conditional Fields: estimate_items_attributes.title, estimate_items_attributes.quantity, estimate_items_attributes.price must be provided if any items are added (HTTP 422 on failure)
Unique Fields: number (HTTP 422 on failure)

Update An Estimate

PUT /api/v2/estimates/:id

You may provide a partial list of fields to update

  {
    "estimate": {
      "number": 185, 
      "date": "2011-07-29",  
      "currency_code": "USD", 
      "estimate_items_attributes": [
        {
          "id": 501,
          "_destroy": true
        }, 
        {
          "id": 502
          "title": 'bar', 
          "quantity": 2, 
          "price": 200
        },
        {
          "title": 'bar', 
          "quantity": 2, 
          "price": 200
        }
      ]
    }
  }

In estimate_items_attributes, provide id to edit an existing estimate_item or omit id to create new invoice items. Provide _destroy attribute along with id to delete the estimate item.

Unique Fields: number (HTTP 422 on failure)

Delete An Estimate

DELETE /api/v2/estimates/:id

Deleting an estimate will result in the deletion of all associated Estimate Items. Deletions are permanent and not reversible.

Send An Estimate

POST /api/v2/estimates/:id/messages
{
  "recipients": ["[email protected]", "[email protected]"],
  "subject": "Subject for estimate", 
  "message": "Body message for estimate", 
  "send_copy": 1,
  "attach_pdf": 1
}

Required Fields: recipients - an array of email addresses. (HTTP 422 on failure)
Encouraged Fields: subject, message are strongly encouraged, since this is what displays in the email, but it is not required.
Optional Fields: send_copy optionally allows the sending user (dependent on API Token used) to receive a copy of the email, attach_pdf allows an optional PDF to be attached to the invoice.