# Invoice API not sending any response when adding invalid category

**URL:** <https://api-discuss.freeagent.com/t/invoice-api-not-sending-any-response-when-adding-invalid-category/535>\
**Category:** Uncategorized\
**Created:** [16 April 2015 10:55 UTC](https://api-discuss.freeagent.com/t/invoice-api-not-sending-any-response-when-adding-invalid-category/535 "2015-04-16T10:55:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vikaskhairnar](https://api-discuss.freeagent.com/letter_avatar_proxy/v4/letter/v/85f322/32.png) [@vikaskhairnar](https://api-discuss.freeagent.com/u/vikaskhairnar)\
**Post date:** [16 April 2015 10:55 UTC](https://api-discuss.freeagent.com/t/invoice-api-not-sending-any-response-when-adding-invalid-category/535/1 "2015-04-16T10:55:20Z")

</div>

Hi,

I am using freeagent API’s for creating customer invoices etc.

While creating invoices through API’s if I pass bank category code instead  
of Sales category code it was failed that invoice to pass to package but it  
was not send any response like “invalid category code” etc.

how should I get any response in this scenario because I need to send  
proper error to my clients in this scenarios.

---

<div class="post-metadata">

**Author:** ![David\_Jones](https://api-discuss.freeagent.com/user_avatar/api-discuss.freeagent.com/david_jones/32/55_2.png) [@David\_Jones](https://api-discuss.freeagent.com/u/David_Jones)\
**Post date:** [20 April 2015 14:07 UTC](https://api-discuss.freeagent.com/t/invoice-api-not-sending-any-response-when-adding-invalid-category/535/2 "2015-04-20T14:07:09Z")

</div>

Hi there,

From your description of the problem, it sounds like you might be passing a  
reference to an “Admin Expense” category or a “Cost of Sales” category,  
rather than an “Income Category”.

I’ve just tested the API and for both of these errors, meaningful error  
messages are returned:

“message”: “Income Category expected, got Admin Expenses Category”  
“message”: “Income Category expected, got Cost Of Sales Category”

It’s possible I’m misunderstanding your query. Would you mind providing an  
example of the parameters you’re sending to the /invoices end-point, please?

Thanks!  
Dave JOn 16 April 2015 at 11:55, [vikaskhairnar@commusoft.co.uk](mailto:vikaskhairnar@commusoft.co.uk) wrote:

> Hi,
> 
> I am using freeagent API’s for creating customer invoices etc.
> 
> While creating invoices through API’s if I pass bank category code instead  
> of Sales category code it was failed that invoice to pass to package but it  
> was not send any response like “invalid category code” etc.
> 
> how should I get any response in this scenario because I need to send  
> proper error to my clients in this scenarios.
> 
> –  
> You received this message because you are subscribed to the Google Groups  
> “FreeAgent API” group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [freeagent\_api+unsubscribe@googlegroups.com](mailto:freeagent_api+unsubscribe@googlegroups.com).  
> To post to this group, send email to [freeagent\_api@googlegroups.com](mailto:freeagent_api@googlegroups.com).  
> Visit this group at [http://groups.google.com/group/freeagent\_api](http://groups.google.com/group/freeagent_api).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

David Jones  
Senior Support Engineer

FreeAgent
