# Grant access

`POST https://api.tentary.com/v1/access/grant`

Source: https://tentary.com/en/help/api/grant-access/
Area: Customers and access
MCP tool: `grant_access`. Changes data at once.

---

Gives a person access to a live product without an order: no payment and no invoice. For example a gift, or a purchase on another platform.

- Creates the customer if needed. A customer created this way counts toward the plan limit of external customers until they buy.
- The person gets an email with the access link, unless `send_email` is `false`.
- It does not subscribe the person to the newsletter.
- Not possible for booking, newsletter and external products.

## Authorization

`Authorization: Bearer <API key>`

A personal API key (tnt_...). Create it in the Tentary app on the page AI & API.

## Request body

- `email` (string, required): The customer's e-mail address. Limits: minLength 3, maxLength 255.
- `product_id` (integer, required): The id from list_products. Limits: min 1.
- `variant_id` (integer): Needed for a product with variants (get_product shows them). Limits: min 1.
- `first_name` (string): For a new customer. Limits: maxLength 100.
- `last_name` (string): For a new customer. Limits: maxLength 100.
- `reason` (string): Shown in the app. Default manual. Allowed values: `manual`, `complimentary`, `purchased_elsewhere`.
- `send_email` (boolean): Send the access e-mail (default true).

## Response

- `status` (string): exists and purchased: the customer had access already, so no grant was added. A deactivated customer is still reactivated: see customer.reactivated. Allowed values: `created`, `reactivated`, `exists`, `purchased`.
- `message` (string): What happened, in words for the seller.
- `grant_id` (integer, can be null): The ID of the access grant.
- `customer` (object): The customer.
  - `id` (integer): The ID.
  - `email` (string): E-mail address.
  - `created` (boolean): true = a new customer.
  - `reactivated` (boolean): true = a deactivated customer was reactivated.
- `product` (object): The product.
  - `id` (integer): The ID.
  - `name` (string): The name.
  - `variant_id` (integer, can be null): The variant ID, if any.
- `access_email` (string): queued = the e-mail with the access link goes out in the next minutes. suppressed = the address bounced before. Allowed values: `queued`, `suppressed`, `not_sent`.

## Example request

```bash
curl -X POST "https://api.tentary.com/v1/access/grant" \
  -H "Authorization: Bearer $TENTARY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "email": "lisa.hahn@example.com",
  "product_id": 101,
  "first_name": "Lisa",
  "last_name": "Hahn",
  "reason": "complimentary"
}'
```

## Example response

```json
{
  "status": "created",
  "message": "Access granted.",
  "grant_id": 2,
  "customer": {
    "id": 405,
    "email": "lisa.hahn@example.com",
    "created": true,
    "reactivated": false
  },
  "product": {
    "id": 101,
    "name": "Yoga Basics E-Book",
    "variant_id": null
  },
  "access_email": "queued"
}
```
