Publish the site after DELETE item

I’m using the Webflow CMS API to delete items from my CMS.

The items get deleted fine, but it seems that after deleting them I need to republish the site. Am I correct to assume that?

According to the Publish Site section of the API, I need to pass two parameters: site_id and domains.
I got the site_id right, but can’t seem to find the right thing to pass for domains.

I tried to pass my staging domain: mysite.webflow.io but that didn’t work.

When I try to list the domains associated with my site, according to the API docs, I get an empty JSON object.

Any help would be much appreciated!

Hi I had trouble with this myself as well but I figured it out. Make sure you try it on Postman so that you can see that your request is working there first. Use a POST request, add your bearer token in Authorization, set the header for accept-version to 1.0.0, and for the body use raw and pass in the correct JSON object:

{“domains”: [“test-api-domain.com”]}

You can find the domains on your webflow dashboard. Where you publish your sites manually in the editor, you’ll also be able to see your domains there. Hope this helps

My experience is that if you do this on a site that is not published on a custom domain, it doesn’t work.

to know your domain name via the API, you have to send this request (I copy the request from the webflow API page it’s not a real request)

curl https://api.webflow.com/sites/580e63e98c9a982ac9b8b741/domains \
    -H "Authorization: Bearer d59f681797fbb3758b2a0ce8e5f31a199e2733110cb468bb2bb0d77f23417b32" \
    -H 'accept-version: 1.0.0'

If you have a custom domain you will get something like this in response

[{“_id”:“6087c72c8fa197362467U680”,“name”:“voici.xyz”,“lastPublished”:“2021-10-30T08:43:14.194Z”},{“_id”:“6087c72c8fa197362467U680”,“name”:“www.voici.xyz”,“lastPublished”:“2021-10-30T08:43:14.194Z”}]

If your site is just published on Webflow.io you get this.

[ ]

At first I thought that it means that there is no published site for the API so you can’t pushish it via API

BUT BUT

EDIT EDIT : it’s possible but be shure to respect all quotes single an double in this one
11111 is the site ID
222222 is the API key

curl https://api.webflow.com/sites/1111111111111111111111/publish \
    -H \"Authorization: Bearer 222222222222222222222222222\" \
    -H 'accept-version: 1.0.0' \
    -H \"Content-Type: application/json\" \
    --data-binary $'{
      \"domains\": [\"personnal-site.webflow.io\"]
    }'