> For the complete documentation index, see [llms.txt](https://ayakaleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ayakaleaf-pro.ayaka.space/on-premises/configuration/overleaf-toolkit/overleaf-import-api.md).

# Overleaf Import API

### "Overleaf Import API" feature

Starting with Ayakaleaf Pro v6.3, you can create links that import a LaTeX file or a zipped project from a URL and open it in your own Ayakaleaf instance, similar to Overleaf’s [“Open in Overleaf” API](https://cn.overleaf.com/devs).

This feature is enabled by default, you just need to visit `your.overleaf.com/devs` to see detailed page and instructions.

{% hint style="info" %}
The `/devs` page requires a login unless `OVERLEAF_ALLOW_PUBLIC_ACCESS=true`, see [#signed-out-visitors](#signed-out-visitors "mention").
{% endhint %}

<figure><img src="https://2052729351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyLFrF2L1FakWXkhqpOnS%2Fuploads%2FRd8JVSeP6w4PFlFlX5x9%2Fimage.png?alt=media&amp;token=7b9321ae-d1d5-4f84-ab37-4ad23145bf50" alt=""><figcaption></figcaption></figure>

For example, if you host a LaTeX file at `https://example.com/main.tex` or a complete project at `https://example.com/project.zip`, you can create a link that imports it into your own Ayakaleaf Pro instance and opens the new project:

{% tabs %}
{% tab title="LaTeX file" %}
{% code overflow="wrap" %}

```
https://ayakaleaf.example.com/docs?snip_uri=https%3A%2F%2Fexample.com%2Fmain.tex
```

{% endcode %}
{% endtab %}

{% tab title="ZIP project" %}
{% code overflow="wrap" %}

```
https://ayakaleaf.example.com/docs?snip_uri=https%3A%2F%2Fexample.com%2Fproject.zip
```

{% endcode %}
{% endtab %}
{% endtabs %}

Replace `ayakaleaf.example.com` with your instance’s domain.

#### Open a LaTeX project in Ayakaleaf Pro

Starting with Ayakaleaf Pro v6.3, you can create a link that imports a LaTeX file or a zipped project into your own Ayakaleaf Pro instance. When someone opens the link, Ayakaleaf Pro creates a new project from the supplied file and opens it in the editor.

Send the link to your instance’s `/docs` endpoint:

| Parameter       | Description                                                                                        | Example                                           |
| --------------- | -------------------------------------------------------------------------------------------------- | ------------------------------------------------- |
| `snip_uri`      | URL of a LaTeX file to import. A single ZIP file is also accepted, but use `zip_uri` for projects. | `https://example.com/main.tex`                    |
| `zip_uri`       | URL of a zipped LaTeX project to import.                                                           | `https://example.com/project.zip`                 |
| `snip_uri[]`    | Import multiple files by repeating this parameter.                                                 | `snip_uri[]=.../main.tex&snip_uri[]=.../refs.bib` |
| `snip_name[]`   | Set the filename for each `snip_uri[]`, in the same order.                                         | `snip_name[]=main.tex`                            |
| `engine`        | Set the compiler: `latex_dvipdf`, `pdflatex`, `xelatex`, or `lualatex`.                            | `engine=xelatex`                                  |
| `main_document` | Set the main `.tex` file in the imported project.                                                  | `main_document=main.tex`                          |
| `name`          | Set the name of the new project. `project_name` is also accepted.                                  | `name=My%20Project`                               |

For example, if your files are hosted on `example.com`, these links import them into an Ayakaleaf Pro instance hosted at `ayakaleaf.example.com` .

#### Import a project using Base64

You can embed a LaTeX file or a zipped project directly in an “Open in Ayakaleaf” link as a Base64 data URL. This lets you create an import link without hosting the file at a separate URL.

| Content        | Parameter  | Data URL format                                      |
| -------------- | ---------- | ---------------------------------------------------- |
| LaTeX file     | `snip_uri` | `data:application/x-tex;base64,<base64-encoded-tex>` |
| Zipped project | `zip_uri`  | `data:application/zip;base64,<base64-encoded-zip>`   |

To import a ZIP project, Base64-encode the ZIP file and pass it through `zip_uri` instead. Use `encodeURIComponent` on the complete data URL when constructing either link. For large projects, use a hosted ZIP URL because browser and server URL-length limits can make Base64 links impractical.

#### Add an “Open in Ayakaleaf” button

You can use an HTML form to import a file when a visitor clicks a button. Submit the form to your instance’s `/docs` endpoint with `method="post"`.

For a hosted LaTeX file:

```
<form action="https://ayakaleaf.example.com/docs" method="post" target="_blank">
  <input type="hidden" name="snip_uri" value="https://example.com/main.tex">
  <input type="hidden" name="engine" value="xelatex">
  <button type="submit">Open in Ayakaleaf</button>
</form>
```

To import a zipped project, replace `snip_uri` with `zip_uri` and point it to the ZIP file. You can also submit LaTeX source directly using `snip` for raw text or `encoded_snip` for URL-encoded text.

Replace `ayakaleaf.example.com` with your instance’s domain. If your instance enables cross-origin request blocking, add the website hosting the form to `ALLOWED_ORIGINS`.

#### Signed-out visitors

The new project is created in the visitor's account, so they need to log in. How a signed-out visitor gets there depends on how the import is sent:

* **Links** (`GET /docs?...`) work on every instance: the visitor is sent to the login page and the import continues after logging in.
* **Forms** (`POST /docs`) need `OVERLEAF_ALLOW_PUBLIC_ACCESS=true` for signed-out visitors. The submission is then kept for 10 minutes until the visitor has logged in, and used once.

{% hint style="warning" %}
By default (`OVERLEAF_ALLOW_PUBLIC_ACCESS` not set), a form submitted by a signed-out visitor is sent to the login page before Ayakaleaf Pro reads it, and the submission is lost: after logging in, the visitor sees *no snippet, snip\_uri or zip\_uri provided*. Use links, ask visitors to log in first, or enable public access, see [Public Access](/on-premises/configuration/overleaf-toolkit/public-access.md#page-access).
{% endhint %}

<details>

<summary>What ZIP or TeX resources can I import?</summary>

Ayakaleaf Pro uses the `linked-url-proxy` microservice (mainly used for [External URL](/on-premises/configuration/overleaf-toolkit/external-url.md)) to fetch external resources. In general, any publicly accessible ZIP or TeX resource available over the Internet can be imported. Resources hosted on private or internal networks are blocked for security reasons.

Starting with the re-released Ayakaleaf Pro 6.3.0 (October 3, 2026), you can configure an HTTP(S) proxy for fetching external ZIP and TeX resources with `OVERLEAF_LINKED_URL_OUTBOUND_PROXY`. See [External URL](/on-premises/configuration/overleaf-toolkit/external-url.md#outbound-proxy) for configuration and network access restrictions.

</details>


---

# 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 following URL with the `ask` and `goal` query parameters:

```
GET https://ayakaleaf-pro.ayaka.space/on-premises/configuration/overleaf-toolkit/overleaf-import-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

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.
