> For the complete documentation index, see [llms.txt](https://apidocs.comparocms.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.comparocms.com/rest-api.md).

# REST API

## Get Prefill

Retrieves code and prefill information in a single request.

Base URL: `https://astralis24.com`

Endpoint: `GET /rest.php/get-prefill`

{% hint style="info" %}
Authentication: All requests must include an `API-Key` header with a valid API key.
{% endhint %}

Header Format:

{% code title="Header" %}

```
API-Key: your-api-key-here
```

{% endcode %}

Query Parameters:

* `lang` (optional, default: `DE`) - Language code: `DE`, `FR`, or `IT`
* `page_id` (optional) - Source identifier (e.g., `page2`, `page1`)
* `tracking_code` (optional) - Tracking code for analytics

Example Request:

{% code title="cURL" %}

```bash
curl -X GET "https://astralis24.com/rest.php/get-prefill?lang=DE&page_id=lp3&tracking_code=abc123" \
  -H "API-Key: your-api-key-here"
```

{% endcode %}

Example Response:

{% code title="Response (200)" %}

```json
{
  "status": true,
  "message": "Success",
  "data": {
    "prefill": "...",
    "wa_number": "...",
    "sim_no": "...",
    "code_data": {
      "KW_ABO": "...",
      "short_code": "...",
      "generated_code": "..."
    }
  }
}
```

{% endcode %}

Error Response (401 Unauthorized):

{% code title="Response (401)" %}

```json
{
  "status": false,
  "message": "Unauthorized: Invalid or missing API key",
  "data": []
}
```

{% endcode %}

Notes:

* Facebook cookies (`_fbc`, `_fbp`) are automatically used if available.
* Client IP address and user agent are automatically captured from the request.
* The response includes both `wa_number` and `sim_no` fields.

{% hint style="warning" %}
If your client needs cookies sent with the request (for example to include Facebook cookies), ensure cross-origin requests are configured to allow credentials.
{% endhint %}

JavaScript/jQuery Example:

{% code title="fetchPrefillCombined (JavaScript/jQuery)" %}

```javascript
function fetchPrefillCombined(lang, pageId, trackingCode) {
    $.ajax({
        cache: false,
        async: false,
        type: 'GET',
        url: `https://astralis24.com/rest.php/get-prefill?lang=${lang.toUpperCase()}&page_id=${pageId}&tracking_code=${trackingCode}`,
        dataType: 'json',
        headers: {
            'API-Key': 'your-api-key-here'
        },
        xhrFields: {
            withCredentials: true  // ✅ ensures cookies are sent
        },
        crossDomain: true,
        success: function (data) {
            if (data.status) {
                let url = `sms:${data.data.sim_no}?body=${data.data.prefill}`;
                // let url = `https://wa.me/${data.data.wa_number}?text=${data.data.prefill}`;
                $('#smsClick').attr('href', url);
            }
        }
    });
}
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://apidocs.comparocms.com/rest-api.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.
