Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

281
Views
Status code: 422 (error: {type: 'validation', message: 'Invalid message'})

I am trying to write the following curl post function with basic authentication in vanilla javascript.

curl -X POST \
  https://api.livechatinc.com/v3.3/agent/action/list_chats \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <your_access_token>' \
  -d '{}'

This is my code in javascript.

    (async () => {
      const rawResponse = await fetch(url, {
        method: 'POST',
        headers: {
          'Content-Type' : 'application/json',
          'Authorization': 'Basic ' + btoa(username+":"+password)
        },
        body: {
         "filters.group_ids" : "1",
         "limit" : 1
        }
      });
      const content = await rawResponse.json();
      
      console.log(content);
    })();

I keep getting this error "error: message: "Invalid message" type: "validation""

The curl method works perfectly in postman. I have read the documentation about this error and tried removing the content type header. It did not work. Any help is appreciated.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!