REST API Forbidden


I’m trying to upload data to Cesium ION using the REST API with Python for a client. I set up a free account to do some tests and not mess my client’s account. It was just working more or less fine, but now as soon as I do the first request (step 1 on Automate Your Uploads with the Cesium ion REST API | I get the following response:

    "code": "Forbidden",
    "message": ""

The code that produces this is:

        header = {
            'Authorization': f'Bearer {CESIUM_ION_TOKEN}'
        body = {
            'name': 'file',
            'description': "desc",
            'type': 'TERRAIN',
            'options': {
                'sourceType': 'RASTER_TERRAIN',
                'heightReference': 'MEAN_SEA_LEVEL',
                'toMeters': 1,
                'baseTerrainId': 1
        r ='', headers=header, json=body)
        print('Step 1 done.')
        response = r.json()
        print(json.dumps(response, indent=4, sort_keys=True))

This code was working until now and I’m using the same token. I was testing the final steps of the upload process, this one was already working. Plus, there is no message as to why it is forbidden and the web interface looks normal (no message either as to why am I being forbidden).

Does anybody know if there is some kind of restriction or limitation on the usage of the REST API with a free account? And if so, what would be the proper way of implementing this in my code and be able to do tests without being forbidden?

Thank you!

Check the scope of your access token.

Thanks for the answer ZhefengJin, but I’m using the same token I was using when was working. I only changed it when I started having this error and created another one with everything, just in case. I still get the same error.