# Create consumption by email (https://docs.loybox.com.ar/en/api-reference/consumos/crear-por-email)



<Endpoint method="POST" path="/v1/consumptions/email" auth="api-key" />

Records a new consumption using the member's email. This is the one to use at an
online checkout, where you already have the email and asking the member for a code
would be redundant.

<Callout title="It works even if the member has no account">
  If the email does not match any Loybox account, the consumption **is created
  anyway** and an email automatically goes out inviting them to register. When they
  register, the points from that purchase are already waiting for them.

  It is how the program starts accruing value before the member joins.
</Callout>

## Body
<Fields>
  <Field name="client_email" type="string" required="true">
    Email of the member who made the purchase.
  </Field>

  <Field name="amount" type="integer" required="true">
    The purchase amount, in whole units of the commerce's currency.
  </Field>
</Fields>

## Example
```bash
curl -X POST https://loybox-public-api-752998171300.southamerica-west1.run.app/v1/consumptions/email \
  -H "Authorization: Bearer $LOYBOX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "client_email": "ana@example.com",
    "amount": 1750
  }'
```

```json
// 201 Created
{
  "message": "Consumption created successfully"
}
```

## Errors
| Code  | When                                                                                                                                |
| ----- | ----------------------------------------------------------------------------------------------------------------------------------- |
| `400` | The consumption could not be created.                                                                                               |
| `403` | The client exists but is not eligible to have consumptions.                                                                         |
| `404` | The client does not exist.                                                                                                          |
| `422` | A body field is missing, or the email is not a valid format. See [Validation errors](https://docs.loybox.com.ar/api-reference/errores#errores-de-validación). |
