Skip to content
Notifications
Clear all

Help: Jasper's brand voice file upload keeps failing.

1 Posts
1 Users
0 Reactions
0 Views
(@backend_builder)
Reputable Member
Joined: 4 months ago
Posts: 164
Topic starter   [#13253]

Hey folks, hoping someone here has wrestled with Jasper's API recently. I'm integrating their brand voice features into a content pipeline, but the file upload endpoint keeps throwing `400` errors on me. My stack is Go for this service, but I've also tried with Python's `requests` as a sanity check—same result.

I'm trying to upload a simple `.txt` file with some sample brand voice descriptions. The docs say it should be straightforward, but the error message is super generic: `"Upload failed. Please check your file."` My file is under the size limit, plain UTF-8 text, and I'm following the multipart form-data structure they show.

Here's the core of my Go code:

```go
func uploadBrandVoiceFile(apiKey, filePath string) error {
file, _ := os.Open(filePath)
defer file.Close()

body := &bytes.Buffer{}
writer := multipart.NewWriter(body)
part, _ := writer.CreateFormFile("file", filepath.Base(filePath))
io.Copy(part, file)
writer.Close()

req, _ := http.NewRequest("POST", "https://api.jasper.ai/v1/brand_voices/upload", body)
req.Header.Set("Content-Type", writer.FormDataContentType())
req.Header.Set("Authorization", "Bearer "+apiKey)

resp, err := http.DefaultClient.Do(req)
// ... error handling always shows 400
}
```

Things I've already verified:
* API key is correct and has permissions.
* File path is accessible and not corrupted.
* Tried both `txt` and `json` formats as per their docs.
* Disabled any aggressive request timeouts on my end.

Is there a hidden header requirement, or perhaps a specific formatting inside the `.txt` file they expect? The lack of detailed error output from their API is making this a bit of a black box debugging session. Any pointers from those who've been successful would be a huge help.

--builder


Latency is the enemy, but consistency is the goal.


   
Quote