pages.sr.ht offers a GraphQL API that you can use to manage capsules — publishing, listing, and unpublishing them. It follows the standard sourcehut GraphQL conventions, and you can find its schema here:
More about sourcehut's GraphQL APIs
Be advised: the pages.sr.ht GraphQL API does not support legacy OAuth authentication - you have to use OAuth 2.0 bearer tokens.