How do i find the required form id from my KoBoToolbox account

Using the API v1, one can retrieve data with the url https://kc.humanitarianresponse.info/api/v1/data/XXXXXX.csv
with XXXXXX being the form id.
I have tested it with XXXXXX = 253043 which was a form id I found online.

But how can I find the form id for my specific form?

The closest to an answer I could find on the forum was Is there a simple way to find your FormID? but it doesn’t help.
I am fluent in R and can use a command line to retrieve this information.

Hi @acornamr,

Welcome to the Kobo forum :slightly_smiling_face:

You can view a list of your assets on the v1 API with a GET request to to endpoint /api/v1/data.json if you provide your authentication details with the request.

For example, I can see my assets simply using curl from the terminal:

curl 'https://kc.kobotoolbox.org/api/v1/data.json' -H 'Cookie: csrftoken=<token>; kobonaut=<kobonaut>'

This will give you an output like this:

[
  {
    "id": 123456,
    "id_string": "qwerty12345",
    "title": "foo",
    "description": "foo",
    "url": "https://kc.kobotoolbox.org/api/v1/data/123456.json"
  },
  {
    "id": 123457,
    "id_string": "qwerty123456",
    "title": "bar",
    "description": "bar",
    "url": "https://kc.kobotoolbox.org/api/v1/data/123457.json"
  },
]
1 Like

Thanks a lot Josh. I had retrieved the token recently so I am happy to use it.

I have tried curl 'https://kc.kobotoolbox.org/api/v1/data.json' -H 'Cookie: csrftoken=2f0...9ac; kobonaut=acornamr' but without success as Terminal returns {"detail":"Authentication credentials were not provided."}%

Is the kobonaut not my login id? Or could it be another issue?

Sorry @acornamr, this is actually the correct way to go about it with your token obtained at the /token endpoint. The above is the way the browser authorizes the request with a cookie.

curl 'https://kc.kobotoolbox.org/api/v1/data.json' -H 'Authorization: Token <token>'
1 Like

Thanks Josh, that worked!

2 Likes