# Why do I get an "invalid character" error when I make a Notehub API request?

**URL:** <https://discuss.blues.com/t/why-do-i-get-an-invalid-character-error-when-i-make-a-notehub-api-request/884>\
**Category:** Notehub.io\
**Created:** [June 22, 2022, 11:56am UTC](https://discuss.blues.com/t/why-do-i-get-an-invalid-character-error-when-i-make-a-notehub-api-request/884 "2022-06-22T11:56:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gwolff](https://avatars.discourse-cdn.com/v4/letter/g/a88e57/32.png) [@gwolff](https://discuss.blues.com/u/gwolff)\
**Post date:** [June 22, 2022, 11:56am UTC](https://discuss.blues.com/t/why-do-i-get-an-invalid-character-error-when-i-make-a-notehub-api-request/884/1 "2022-06-22T11:56:46Z")

</div>

When I make an API request to Notehub, I receive the following:

```auto
{
"err": "malformed request",
"code": 400,
"status": "Bad Request",
"request": "/v1/projects/app:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/devices/dev:xxxxxxxxxxxxxxxx/provision",
"details": {
"body": ""
},
"debug": "invalid character '-' in numeric literal"
}

```

It doesn’t seem to matter what request I make, I get the same message in the `debug` field of the response.

# Solution - Ensure Encoding is JSON

Make sure the body of the request is formatted as raw JSON.

That is use

```raw
Content-Type: application/json

```

in the HTTP request.

If it is sent as `form-data` or `x-www-form-urlencoded` then you will see the above error message.

Here’s an example using cURL

```auto
curl --request POST --url 'https://api.notefile.net/v1/projects/app:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/devices/dev:xxxxxxxxxxxxxxx/provision' --header 'Content-Type: application/json' --header 'x-session-token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' --data '{"product_uid":"com.email.name:projectname"}'

```

Here’s an example of how the body is formatted correctly in Postman.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/blues/original/1X/c651e1ab437f6d18cc7d0a3792eec10a6d4b8388.png)
