FreshSales create a file API

Hi Everyone,

We create a file using “https://domain.myfreshworks.com/crm/sales/api/documents” API in FreshSales.

But we are facing this { errors: { code: 400, message: [ ‘Bad Request’ ] } }.

The body we pass through the API:
image

Thank You.

Hi S.Ram.K

A “400 Bad Request” error usually indicates an issue with the request you’re sending to the API. Based on your description, you’re using the FreshSales “Create a File” API. To help you troubleshoot this issue, please ensure the following points:

  1. Check the API endpoint URL: Ensure you’re using the correct domain and API endpoint. It should be in the format: https://yourdomain.myfreshworks.com/crm/sales/api/documents

  2. Ensure correct method: The API call should be a POST request.

  3. Authorization: Ensure the API key you’re using for authorization is correct and valid.

  4. Content-Type: Make sure you’re using the correct content-type for file upload in your request header. It should be multipart/form-data.

  5. Verify the request body: Ensure you’re passing the required parameters in the request body, such as file, folder_id, and parent_id