# get_site_message_key

Source: https://modulify.ai/docs/api/messages/get-site-message-key

Reveals the texting key of a site in plain text, with the API URL it goes with, creating the key when the site has none yet.

- Title: Reveal the texting key of a site
- Scope: `credentials:reveal`
- Access: Makes changes
- Endpoint: `POST /v1/get_site_message_key`

It is the server only credential the site's own server code sends texts with, injected as `MODULIFY_MESSAGES_KEY` next to `MODULIFY_MESSAGES_URL`, and anyone holding it can text from the site and spend the workspace credits. The answer carries the `key`, the `url` it goes with and `keyChangedAt`.

The key is returned in full, so it lands in the conversation. The tool tells the client never to print it, never to put it in a page, a client component or a committed file, and never to send it anywhere you did not ask for. It also tells the client to reach for it only when you explicitly ask to see or copy your key, for example to text from a server of your own outside Modulify.

It needs the **Delete projects** permission in the workspace, which showing the key in the Messages tab needs too. It is the only tool that returns the key, and `credentials:reveal` is unticked by default when you create a token. See [Send texts from your site's code](https://modulify.ai/docs/built-in/messages#send-texts-from-your-sites-code).

## Request

Call it with a `POST` to `https://api.modulify.ai/v1/get_site_message_key`, sending the inputs below as a JSON object. The token needs the `credentials:reveal` scope.

It makes changes, so send an [Idempotency-Key](https://modulify.ai/docs/api/idempotency) header whenever you might retry it. A retry with the same key gets the first answer back instead of running again.

```bash
curl -X POST https://api.modulify.ai/v1/get_site_message_key \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"projectId":"PROJECT_ID"}'
```

Over MCP, the same method is the [get_site_message_key tool](https://modulify.ai/docs/mcp/messages/get-site-message-key).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site id. |

## Response

Every call answers with the [JSON envelope](https://modulify.ai/docs/api/requests-and-responses#the-response) of `success`, `message`, `data`, `code` and `version`. `data` holds the result described above, and on a method that returns a total, `count` carries it. The [response headers](https://modulify.ai/docs/api/requests-and-responses#headers-on-every-method-call) carry the call's `X-Request-Id` and what is left of your per-minute budget in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. [Errors](https://modulify.ai/docs/api/errors) explains every status code a call can answer with.