I found this old user community post which answers that it is possible Archive space for inactive users through REST API
curl --request PUT
–url ‘https://your-domain.atlassian.net/wiki/rest/api/space/{spaceKey}’
–user ‘email@example.com:’
–header ‘Accept: application/json’
–header ‘Content-Type: application/json’
–data ‘{“status”: “archived”}’
If it’s a personal space you’ll need an extra property "type": "personal"
:
curl -v --request PUT
–url 'https://instancename.atlassian.net/wiki/rest/api/space/~12345
–user 'username@domain.com:APITOKEN
–header ‘Accept: application/json’
–header ‘Content-Type: application/json’
–data ‘{“type”: “personal”, “status": “archived”}’