# Send Auth Email

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

POST https://api.g.alchemy.com/signer/v1/auth

Sends a user an email containing a magic link for authentication, allowing them to complete the login process and access their Smart Wallet through a secure, simple email verification method. Developers can customize the appearance and content of the authentication email through Alchemy dashboard to align with their application's branding and user experience requirements.


Reference: https://www.alchemy.com/docs/wallets/api-reference/signer/signer-api-endpoints/send-email-auth

## Headers

| Name | Type | Required | Description |
|------|------|----------|-------------|
| Authorization | string | Yes | Bearer token authentication. Use 'Bearer <apiKey>' as the value. |

## Code Examples

### cURL

```bash
curl --request POST \
  --url https://api.g.alchemy.com/signer/v1/auth \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "email": "string",
  "targetPublicKey": "string",
  "expirationSeconds": "string",
  "redirectParams": "string"
}'
```

### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    email: 'string',
    targetPublicKey: 'string',
    expirationSeconds: 'string',
    redirectParams: 'string'
  })
};

fetch('https://api.g.alchemy.com/signer/v1/auth', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.g.alchemy.com/signer/v1/auth"

payload = {
    "email": "string",
    "targetPublicKey": "string",
    "expirationSeconds": "string",
    "redirectParams": "string"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

### Go

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.g.alchemy.com/signer/v1/auth"

	payload := strings.NewReader("{\n  \"email\": \"string\",\n  \"targetPublicKey\": \"string\",\n  \"expirationSeconds\": \"string\",\n  \"redirectParams\": \"string\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")
	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
```

### Java

```java
HttpResponse<String> response = Unirest.post("https://api.g.alchemy.com/signer/v1/auth")
  .header("Content-Type", "application/json")
  .header("Authorization", "Bearer <token>")
  .body("{\n  \"email\": \"string\",\n  \"targetPublicKey\": \"string\",\n  \"expirationSeconds\": \"string\",\n  \"redirectParams\": \"string\"\n}")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://api.g.alchemy.com/signer/v1/auth");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n  \"email\": \"string\",\n  \"targetPublicKey\": \"string\",\n  \"expirationSeconds\": \"string\",\n  \"redirectParams\": \"string\"\n}", false);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);

```


## Operation Specification

```yaml
path: /auth
method: POST
operation:
  summary: Send Auth Email
  description: |
    Sends a user an email containing a magic link for authentication, allowing them to complete the login process and access their Smart Wallet through a secure, simple email verification method. Developers can customize the appearance and content of the authentication email through Alchemy dashboard to align with their application's branding and user experience requirements.
  security:
    - apiKey: []
  x-readme:
    samples-languages:
      - javascript
      - curl
      - python
      - go
  requestBody:
    content:
      application/json:
        schema:
          type: object
          properties:
            email:
              description: The email address of the user requesting access. This is where the authentication email, containing the magic link, will be sent.
              type: string
            targetPublicKey:
              type: string
              description: |
                Authentication of a client is done via an HPKE flow that allows the client and TEE to exchange an encrypted bundle without revealing it to a middleman (you, us, or Turnkey). The targetPublicKey is the public key that the client uses to decrypt the shared secret.

                See more in the [Turnkey Docs](https://docs.turnkey.com/embedded-wallets/sub-organization-auth).
            expirationSeconds:
              type: string
              description: |
                Specifies the duration of the login session in seconds. After this period, the user has to re-login to refresh their session. The default value is 900 seconds (15 minutes).
            redirectParams:
              type: string
              description: Redirect parameters appended to the magic link.
          required:
            - email
            - targetPublicKey
  responses:
    '200':
      description: Authentication email sent successfully.
      content:
        application/json:
          schema:
            type: object
            properties:
              orgId:
                description: The organization ID associated with the user and the application, facilitating the authentication process within the context of the user's application.
                type: string
              otpId:
                type: string
                description: OTP request identifier
            required:
              - orgId
  operationId: sendEmailAuth
```
