# Get a Mailbox Alias

### What's a Mailbox Alias?

Every email address on Maildrop has a corresponding "Mailbox Alias", which is an encoded two-way-hash of the email address itself, with the secret key for the hash known only to Maildrop.

This means, if you wanted to give someone the address "<myaddress@maildrop.cc>" but didn't want them to be able to go to the site and read that mailbox, you could give them the mailbox alias, for example "<D-1lfhru8dn@maildrop.cc>". Messages sent to this mailbox alias would still go to <myaddress@maildrop.cc> but the sender wouldn't know the true destination.

This serves as an additional layer of security if you're concerned about others getting access to the mailbox.

Each mailbox on the maildrop.cc site has this section which includes the mailbox alias:

<figure><img src="https://1498796057-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuZvOoshvlpuzKKHG2Gf0%2Fuploads%2FVHvj9EG9ZUO11F8Znagj%2Falias.png?alt=media&#x26;token=2ff81283-e1f0-4ef3-a645-b5c99cd12c04" alt="A sample Maildrop alias address."><figcaption><p>From the maildrop.cc website</p></figcaption></figure>

{% hint style="info" %}
If you're using Maildrop in an automated fashion it's unlikely that you'll need to query for the mailbox alias - it's more useful for you to just create a unique address that only you know (for example, a uuidv4 address @ maildrop.cc).
{% endhint %}

## Gets the Mailbox Alias for a given mailbox.

<mark style="color:green;">`POST`</mark> `https://api.maildrop.cc/graphql`

Retrieves the Mailbox Alias for the address in the query. The query does not need to contain the entire email address, just the username portion. For example, "<test@maildrop.cc>" only needs "test" as the query parameter.

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-Type | String | application/json |

#### Request Body

| Name | Type   | Description                                                        |
| ---- | ------ | ------------------------------------------------------------------ |
|      | String | '{"query":"query Example { altinbox(mailbox:\\"myusername\\") }"}' |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "data": {
        "altinbox": "D-1lp8kheq"
    }
}
```

{% endtab %}
{% endtabs %}

#### Examples

{% tabs %}
{% tab title="curl" %}

```bash
curl --request POST \
    --header 'content-type: application/json' \
    --url https://api.maildrop.cc/graphql \
    --data '{"query":"query Example {\n altinbox(mailbox:\"testing\") }"
```

returns:

```json
{"data":{"altinbox":"D-1lp8kheq"}}
```

{% endtab %}

{% tab title="React" %}

```tsx
export const GET_ALIAS = gql`
    query GetAlias($mailbox: String!) {
        altinbox(mailbox: $mailbox)
    }
}`;

interface QueryReturn {
    altinbox: string;
}

interface MyComponentProps {
    mailbox: string;
}

const MyComponent = (props: MyComponentProps) => {
    const [{ loading, error, data }] = useQuery<QueryReturn>(GET_ALIAS, {
        variables: { mailbox: props.mailbox },
    });
    return (
        <div>
            {loading && <div>Loading...</div>}
            {!loading && error && <div>There was an error.</div>}
            {!loading && data?.altinbox && <div>Mailbox Alias: {data.altinbox}@maildrop.cc</div>}            
        </div>
    );
};
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.maildrop.cc/api-reference/get-a-mailbox-alias.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
