# License information

{% hint style="warning" %}
The domain can have 3 `statuses`:

* **NOT\_STARTED**: Waiting for CNAMEs to be validated
* **FAILED**: CNAMEs took to much time to validated (\~1 week)
* **SUCCESS**: CNAMEs validated and ready to send email
  {% endhint %}

## Get your license information

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

```sh
 curl https://api.acymailer.com/api/get_credits \
 -X GET \
 -H 'Content-Type: application/json' \
 -H 'API-KEY: your-license-key' \
 -H 'Version: external'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
  
$acymailer = new AcyMailer\SendingService('your-license-key');

$license = $acymailer->getLicenseInfo();
```

{% endtab %}

{% tab title="Node" %}

```javascript
import {AcyMailer} from '@acymailing/sending-service';

const mailer = new AcyMailer('your-license-key');

const license = await mailer.getLicenseInfo();
```

{% endtab %}
{% endtabs %}

<mark style="color:green;">`POST`</mark> [`/api/get_credits`](https://api.acymailer.com/api/get_credits)

This end point allows you to get your license information

**Headers**

| Name         | Value                |
| ------------ | -------------------- |
| Content-Type | `application/json`   |
| API-KEY      | `<license-key>`      |
| Version      | `Must be "external"` |

**Response**

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

```json
{
  "credits_used": 0,
  "max_credits": 20000,
  "extra_credits": 0,
  "remaining_credits": 20000,
  "license_level": "Essential 2500 yearly",
  "end_date": {
    "date": "2024-06-27 12:36:00.000000",
    "timezone_type": 3,
    "timezone": "Europe/Paris"
  },
  "blocked": false,
  "underVerification": false,
  "is_multisite": false,
  "domains": {
    "test-remi.com": {
      "id": 2473,
      "name": "example.com",
      "complaint_rate": 0,
      "bounce_rate": 0,
      "allowed_complaint_rate": 0,
      "allowed_bounce_rate": 0,
      "warning_complaint_rate": 0,
      "warning_bounce_rate": 0,
      "cname": [
        {
          "name": "jxk2iw5axystyacwsoclovgo5leyebhk._domainkey.example.com",
          "type": "CNAME",
          "value": "jxk2iw5axystyacwsoclovgo5leyebhk.dkim.acymailer.com"
        },
        {
          "name": "v4zp5cbi5aupszylq6sg7dphor7c25uj._domainkey.example.com",
          "type": "CNAME",
          "value": "v4zp5cbi5aupszylq6sg7dphor7c25uj.dkim.acymailer.com"
        },
        {
          "name": "sbx65schzrpjznq6hhk2as4l5i62n6qx._domainkey.example.com",
          "type": "CNAME",
          "value": "sbx65schzrpjznq6hhk2as4l5i62n6qx.dkim.acymailer.com"
        }
      ],
      "status": "NOT_STARTED" // "SUCCESS", "NOT_STARTED", "PENDING", "FAILED"
    }
  }
}
```

{% endtab %}

{% tab title="200 Multisite license" %}

```json
{
  "credits_used": 3,
  "max_credits": 200000,
  "extra_credits": 0,
  "remaining_credits": 199997,
  "license_level": "Enterprise 25000 yearly",
  "end_date": {
    "date": "2024-07-04 13:53:00.000000",
    "timezone_type": 3,
    "timezone": "Europe/Paris"
  },
  "blocked": false,
  "underVerification": false,
  "is_multisite": true,
  "domains": {
    "example.com": {
      "id": 1065,
      "name": "example.com",
      "complaint_rate": 0,
      "bounce_rate": 0,
      "allowed_complaint_rate": 0,
      "allowed_bounce_rate": 90,
      "warning_complaint_rate": 0,
      "warning_bounce_rate": 45,
      "cname": [
        {
          "name": "2qojntzdvdnwlszpdlu74ca5paqqipjb._domainkey.example.com",
          "type": "CNAME",
          "value": "2qojntzdvdnwlszpdlu74ca5paqqipjb.dkim.acymailer.com"
        },
        {
          "name": "olcvhxpa7emea7kze75pblf4pshzwkhw._domainkey.example.com",
          "type": "CNAME",
          "value": "olcvhxpa7emea7kze75pblf4pshzwkhw.dkim.acymailer.com"
        },
        {
          "name": "c4u2bysfzjkuemv35n4go42avoxkxw4g._domainkey.example.com",
          "type": "CNAME",
          "value": "c4u2bysfzjkuemv35n4go42avoxkxw4g.dkim.acymailer.com"
        }
      ],
      "status": "SUCCESS",
      "is_limited": true,
      "credits_allowed": 100000,
      "credits_used": 3,
      "remaining_credits": 99997,
      "blocked": false
    }
  },
  "credits_multisite_left": 100000
}
```

{% endtab %}

{% tab title="400" %}

```json
{
    "code": 1,
    "message": "The header `Version` is missing please check the documentation"
}
```

{% endtab %}

{% tab title="401" %}

```json
{    
    "code": 23,
    "message": "Invalid API-KEY"
}
```

{% endtab %}

{% tab title="404" %}

```json
{   
    "code": 23,
    "message": "License not found"
}
```

{% 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.acymailing.com/acymailer/license-information.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.
