404 while API automation

I am getting below error when i am sending get request to endpoint using playwright and Javascript. Could you please help me why i am not able to retrieve all emails and how to use credentials to login in the script.
https://mailsac.com/api/addresses/${mailbox}/messages

Emails: {
message: ‘Not authorized. You may need to log in first.’,
requestId: ‘msfe_rrl5zpA3QHoe5’,
responseTime: ‘3 ms’,
method: ‘GET’,
path: ‘/api/addresses/[email protected]/messages’,
status: 401
}

Hello Vinayak,

The REST endpoint https://mailsac.com/api/addresses/{email}/messages requires authentication per our Swagger Docs.

To use the endpoint you are required to provide the header Mailsac-Key with the value of your API key.

Our Getting Started guide will walk you through the creation of an API key and how to use curl to authenticate and list messages in an inbox.

Let me know if I can be of any further assistance,
Michael

Thanks for the answer! it was really helpful.
Please could you tell me how can i delete private mail address added in my account. I want to add another one and I am using free account.

Hello Vinayak,

Are you wanting to release the private addresses via the REST API or Web UI?