# "העלאה: יצירה" מפתח API לא מספיק?

**URL:** <https://meta.discourse.org/t/upload-create-api-key-insufficient/211896>\
**Category:** Bug\
**Created:** [12 בדצמבר,‏ 2021,‏ 8:32pm UTC](https://meta.discourse.org/t/upload-create-api-key-insufficient/211896 "2021-12-12T20:32:37Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![mattdm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mattdm/32/216484_2.png) [@mattdm](https://meta.discourse.org/u/mattdm)\
**Post date:** [12 בדצמבר,‏ 2021,‏ 8:32pm UTC](https://meta.discourse.org/t/upload-create-api-key-insufficient/211896/1 "2021-12-12T20:32:37Z")

</div>

I’m using the following code to upload through the API:

```plaintext
# And ask Discourse where to send it.
r = requests.post(
    f"https://{DISCOURSE}/uploads/generate-presigned-put", json=file_info, headers=HEADERS)
if r.status_code != 200:
    print(
        f"Error asking where to upload the image: got {r.status_code}", file=sys.stderr)
    sys.exit(1)

upload_url = r.json()['url']
upload_uid = r.json()['unique_identifier']

# Now put it where we were told to.
r = requests.put(upload_url, data=image_data)
if r.status_code != 200:
    print(
        f"Error uploading image to external storage: got {r.status_code}", file=sys.stderr)
    sys.exit(1)

# And tell Discourse that it worked, and get back an id we can reference later.
r = requests.post(f"https://{DISCOURSE}/uploads/complete-external-upload",
                  data=f'unique_identifier={upload_uid}', headers=HEADERS)
if r.status_code != 200:
    print(f"Error completing upload: got {r.status_code}", file=sys.stderr)
    sys.exit(1)
image_id = r.json()['id']

```

This works with an “all access” API key, but when I try to use a granular one with the “uploads: create” scope, I get a 403 error on `post` to `/uploads/generate-presigned-put`.

---

_[View the full topic](https://meta.discourse.org/t/upload-create-api-key-insufficient/211896)._
