Home Forums Support Problem with API based Invoice creation – ""The email field is required …."

This topic contains 2 replies, has 2 voices, and was last updated by  informatix 3 years, 4 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #2542


    Hey there,

    we are testing the API of the hosted version of Invoiceninja, we love the tool and want to automate the invoicing for our users.

    We are testing the API with curl and having troubles with adding a invoice including invoice items via API.

    Following request works:
    curl -X POST https://app.invoiceninja.com/api/v1/invoices -H "Content-Type:application/json" -d '{"client_id":"14"}' -H "X-Ninja-Token:OURTOKEN" -H "X-Requested-With: XMLHttpRequest"

    Following request just results in a error:

    curl -X POST https://app.invoiceninja.com/api/v1/invoices -H "Content-Type:application/json" -d '{"client_id“:“14",
    "invoice_items":[{"id": 160,"product_key": "test","account_key": "gFckhMII5vsv4WzLzuvAIbJRj41kVD2i","user_id": 62773, "notes": "test","cost": 10,"qty": 1, "tax_name": "","tax_rate": 0}]}' -H "X-Ninja-Token:OURTOKEN" -H "X-Requested-With: XMLHttpRequest"

    {“email”:[“The email field is required when client id is not present.”],”client_id”:[“The client id field is required when email is not present.”]}

    Any idea how to fix that?

    Thank you and Cheers from Vienna



    Hillel Coren

    The quotes around client_id:14 in your second request look off



    Argghhhh. Thank you. 🙂 That was the problem.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Posted in: