Sream direct video upload: bad request

I converted he code given in Cloudflare stream direct video upload section to below node.js code, but I get a ‘Bad request’ response.


var request = require(‘request’);
var options = {
‘method’: ‘POST’,
‘url’: ‘$accountid/stream/direct_upload’,
‘headers’: {
‘Authorization’: ‘Bearer $token’,
form: {
‘{\n “maxDurationSeconds”: 3600,\n “expiry”: “2021-03-12T22:20:00Z”,\n “requireSignedURLs”: true\n }’: ‘’
request(options, function (error, response) {
if (error) throw new Error(error);


“result”: null,
“success”: false,
“errors”: [
“code”: 10005,
“message”: “Bad Request”
“messages”: null

Please help me send the proper request.


I am not familiar with the way you’re constructing a request but I believe you need to set the body of the request to the JSON structure instead of using the form field.