Adding questions to a form through a JSON post request

So far, I have been able to create and deploy and new form through a JSON post request using python.

Here’s my code:-

import requests
import json

url = “

para = {“format”:“json”}

payload = {“name”: “postformtest”,
“asset_type”: “survey”}

headers = {‘Content-Type’: “application/json”,‘Accept’: “application/json”}

response =, data=json.dumps(payload), auth=(“myUsername”,“myPassword”), headers=headers, params=para)



url2 = “"+responseJSON[‘uid’]+"/deployment/

payload2 = json.dumps({“active”: True})

response2 =, data=payload2, auth=(“myUsername”,“myPassword”),
headers=headers, params=para)

I can’t find any documentation on how to structure my JSON to add questions to my form. Viewing my asset endpoints only shows the questions as “labels” and viewing it as ssjson seems give more details about the questions but I don’t understand how it can be used to add questions to my surveys or am I going about it the wrong way?

Any help would be greatly appreciated. :blush:

You can either include content alongside name and asset_type when you make your first POST or update it later with a PATCH. Try making a new project and adding a few questions using the form builder, and then visit the asset detail URL (<your-asset-uid>/?format=json). You should see your questions in the content object, which contains survey, choices, and settings—these should look familiar if you know XLSForm.

Alternatively, you could import XLSForm directly using the API as described in KoBo API examples, using new KPI endpoints.


Thanks. I have successfully added questions to my form using JSON. :grin: