POST /block is returning 500 consistently
# support
o
I'm trying to create a workflow from the API but I keep receiving 500. My request POST /block {type: "conversation", instruction: "Ask the user for his name."}
v
@ovistoica I'm sorry to hear that you're experiencing issues with your API request. It seems like there might be a problem with the format of your request. To help you better, I'll need to create a proper data payload for you. Here's how you can structure your request correctly:
Copy code
json
{
  "type": "conversation",
  "instruction": "Ask the user for his name."
}
Make sure to include this as a JSON payload in the body of your POST request, and also include the necessary headers such as 'Authorization' and 'Content-Type'. If you continue to experience issues, please provide more details or ask support for more info on this.
You can continue this conversation by mentioning me in the message.
o
@Vapi Yes yes. I tried this request from both the Typescript server sdk
Copy code
javascript
client.blocks.create({type: "conversation", instruction: "Ask the user for his name."}).then((res) => console.log(res))
And api call
Copy code
bash
curl -X POST https://api.vapi.ai/block \
     -H "Authorization: Bearer " \
     -H "Content-Type: application/json" \
     -d '{
  "type": "conversation",
  "instruction": "Ask user for his name"
}'
v
@ovistoica It looks like you're on the right track with both the TypeScript SDK and the cURL command. However, there might be a small mistake in the URL you're using for the API call. The endpoint should likely be
/blocks
instead of
/block
. Additionally, ensure that you have a valid access token in the "Authorization" header. Here's the corrected TypeScript SDK code:
Copy code
javascript
client.blocks.create({type: "conversation", instruction: "Ask the user for his name."})
  .then((res) => console.log(res))
  .catch((error) => console.error(error));
And the corrected cURL command:
Copy code
bash
curl -X POST https://api.vapi.ai/blocks \
     -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{
  "type": "conversation",
  "instruction": "Ask the user for his name"
}'
Make sure to replace
YOUR_ACCESS_TOKEN
with your actual access token. If you're still encountering a 500 error after these adjustments, it could be an issue on the server side or with the access token. Please check the server response body for any error messages that can provide more details, and if necessary, reach out to the API support for further assistance.
o
@Vapi Yes, ofcourse I include the API key, I'm just not sharing it here and yes the correct url is
/block
as per the api documentation.
v
@ovistoica Thank you for clarifying that you've included the API key and that the correct endpoint is
/block
as per the API documentation. If you're still receiving a 500 Internal Server Error, it indicates that there's an issue on the server side that you cannot resolve on your own. Here are a few steps you can take to troubleshoot the issue: 1. Double-check the API documentation to ensure that all required parameters are included in your request. 2. Verify that the API key is valid and has the necessary permissions to create a block. 3. Look for any additional error messages in the server's response body, as they may provide more insight into what's going wrong. 4. If possible, enable any logging or debugging features provided by the API to get more detailed error information. If after these steps the issue persists, it's best to contact the API support team with the details of your request and the error you're receiving. They will be able to provide more specific guidance and help resolve the issue. In the meantime, if there's anything else I can assist you with, please let me know!
o
It is server side for sure. Here is what I get back
Copy code
Body: {
  "statusCode": 500,
  "message": "Internal server error"
}
@Vapi How can I contact the API support team?
v
@ovistoica To contact the API support team, you should look for the contact information provided in the API documentation or on the website of the service provider. Typically, API providers offer a few different methods to reach out for support: 1. **Support Email**: Check for a support or help email address where you can send a detailed description of your issue. 2. **Support Ticket**: There might be a system in place for submitting support tickets directly through their website or developer portal. 3. **Live Chat**: Some services offer live chat support on their website. 4. **Community Forums**: There might be community forums or discussion boards where you can post your issue. 5. **Phone Support**: Less common for API providers, but some may offer phone support. When contacting support, make sure to provide: - A clear description of the problem. - The request you're making, without sensitive information like your API key. - The full error response you're receiving. - Any other relevant information, such as timestamps and logs. If you need further assistance finding the contact information for the API support team, please let me know the name of the API service provider, and I'll do my best to assist you.
o
Resolved if I include more details in the creation