Can't upload files to API deployed site

I’m following along with this tutorial to deploy a basic API

After I create the site I get the id from the response and do a POST request to
with site_id being the id from the previous response.

my body contains:

       "first.html": "c5045de396718f8bed7d275a5db66889f8ba8fcb",
       "second.html": "60a485665b50c25c0ac83b23417ac588421c6bb6",
       "third.html": "9b780b93bf552555404bc5b13951fa568a005904"

this is what I get as a response:

    "id": "5fb42dc5579f7a191c8945db",
    "site_id": "8640475d-9f19-4d34-b47f-5a0a19351f5f",
    "build_id": null,
    "state": "new",
    "name": "tender-lalande-6e744f",
    "url": "",
    "ssl_url": "",
    "admin_url": "",
    "deploy_url": "",
    "deploy_ssl_url": "",
    "created_at": "2020-11-17T20:08:37.230Z",
    "updated_at": "2020-11-17T20:08:37.285Z",
    "user_id": "5f472bba5c2911c32b69b797",
    "error_message": null,
    "required": [],
    "required_functions": null,
    "commit_ref": null,
    "review_id": null,
    "branch": null,
    "commit_url": null,
    "skipped": null,
    "locked": null,
    "log_access_attributes": {
        "type": "firebase",
        "url": "",
        "endpoint": "",
        "path": "/deploys/5fb42dc5579f7a191c8945db/log",
        "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2IjowLCJpYXQiOjE2MDU2NDM3MTcsImQiOnsidWlkIjoiIn19.HQ5v-JTK12J4hf6U3S4YK8_WyEy1QQn1S6ab35PFcS0"
    "title": null,
    "review_url": null,
    "published_at": null,
    "context": "production",
    "deploy_time": null,
    "available_functions": [],
    "screenshot_url": null,
    "site_capabilities": {
        "title": "Netlify Team Free",
        "asset_acceleration": true,
        "form_processing": true,
        "cdn_propagation": "partial",
        "build_node_pool": "buildbot-external-ssd",
        "domain_aliases": true,
        "secure_site": false,
        "prerendering": true,
        "proxying": true,
        "ssl": "custom",
        "rate_cents": 0,
        "yearly_rate_cents": 0,
        "ipv6_domain": "",
        "branch_deploy": true,
        "managed_dns": true,
        "geo_ip": true,
        "split_testing": true,
        "id": "nf_team_dev",
        "cdn_tier": "reg"
    "committer": null,
    "skipped_log": null,
    "manual_deploy": true,
    "file_tracking_optimization": true,
    "plugin_state": "none",
    "has_edge_handlers": false

shouldn’t the state have a value of “uploading” and the required key have a list of the shasums that need to be uploaded?

if I try to continue on and do a PUT request with a file in it I get back

    "code": 401,
    "message": "Access Denied: deploy must be in , not new"

I’m not sure what I’m doing wrong all the docs I read seem to not have any help on this.

Hey @jhell85,
Sounds like maybe some steps are happening out of order. Here are the calls you need:

  1. empty POST to to create the site
  2. POST to with the file list
  3. PUT to with the file
  4. more PUTs for each file

If that doesn’t help clarify things, would you mind please sharing the requests you’re making, step by step? When you say “After I create the site I get the id from the response”, how are you creating the site there?

UPDATE: So the reason that my POST request to always returns an empty required field is because I didn’t format my request body in JSON properly.

Anyways, thanks Jen for the awesome tutorial. Manual deploy is an interesting topic and I hope to see it developed more going into the future.

I’m running into the same issue as the original poster, and I’m also following the same tutorial on Netlify blog. I don’t know how to share the requests, but here is the Postman collection that I’m using.

I notice that the response I got after POST to didn’t look the same as what Jen got in your tutorial.

The response that I got

No matter how many times I tried to start from a blank state, the required field is always empty.

If I switched to the zip file methods, it works.

1 Like

Hey @bytrangle,
I’m so glad the tutorial was useful for you! And thanks for coming back to report your fix. The JSON formatting can def be tricky…

I agree that the API deploys and our API in general are super interesting. I’m hoping to write more posts on the topic, so if there’s anything in particular you’d be curious to read about, please let me know :slight_smile: