# Plugin API

## 🔑 List available plugins

> List all plugins of the given type.

```json
{"openapi":"3.1.0","info":{"title":"LANraragi API","version":"0.9.6"},"tags":[{"name":"plugins","description":"APIs to list and execute Plugins."}],"servers":[{"url":"https://lrr.tvc-16.science/api"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{"api_key":{"type":"apiKey","name":"Authorization","in":"header","description":"Use Authorization: Bearer <base64(api_key)>"}},"schemas":{"PluginInfo":{"type":"object","description":"Metadata payload for a LRR Plugin.","properties":{"author":{"type":"string","description":"Author of the plugin"},"description":{"type":"string","description":"Description of the plugin"},"name":{"type":"string","description":"Name of the plugin"},"icon":{"type":"string","description":"Base64 image of the plugin icon"},"type":{"type":"string","description":"Type of the plugin","enum":["download","login","metadata","script"]},"namespace":{"type":"string","description":"Unique namespace for the plugin"},"parameters":{"type":"array","items":{"$ref":"#/components/schemas/PluginParameter"}},"version":{"type":"string","description":"Version of the plugin"},"oneshot_arg":{"type":["string","null"],"description":"Description of the manual one-shot argument users can fill in for manual plugin calls"},"url_regex":{"type":["string","null"],"description":"For downloader plugins, regex where it should be used"},"login_from":{"type":["string","null"],"description":"Namespace of the login plugin this plugin depends on"}}},"PluginParameter":{"type":"object","description":"Parameter for a LRR Plugin.","properties":{"name":{"type":["string","null"],"description":"Name of the parameter"},"desc":{"type":"string","description":"Description of the parameter"},"type":{"type":"string","description":"Type of the parameter. This isn't really checked server-side and is used to inform the config page for the plugin.","enum":["bool","int","string"]},"default_value":{"type":["string","null"],"description":"Default value of the parameter"}}}}},"paths":{"/plugins/{type}":{"get":{"operationId":"listPlugins","summary":"🔑 List available plugins","description":"List all plugins of the given type.","tags":["plugins"],"parameters":[{"name":"type","in":"path","required":true,"description":"Type of plugins you want to list. You can use \"all\" to get all types at once.","schema":{"type":"string","enum":["download","login","metadata","script","all"]}}],"responses":{"200":{"description":"Array of plugins","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PluginInfo"}}}}}}}}}}
```

## 🔑 Use a Plugin

> Uses a Plugin and returns the result.  If using a metadata plugin, the matching archive will not be modified in the database. See more info on Plugins in the matching section of the Docs.<br>

```json
{"openapi":"3.1.0","info":{"title":"LANraragi API","version":"0.9.6"},"tags":[{"name":"plugins","description":"APIs to list and execute Plugins."}],"servers":[{"url":"https://lrr.tvc-16.science/api"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{"api_key":{"type":"apiKey","name":"Authorization","in":"header","description":"Use Authorization: Bearer <base64(api_key)>"}}},"paths":{"/plugins/use":{"post":{"operationId":"usePluginSync","summary":"🔑 Use a Plugin","description":"Uses a Plugin and returns the result.  If using a metadata plugin, the matching archive will not be modified in the database. See more info on Plugins in the matching section of the Docs.\n","tags":["plugins"],"parameters":[{"name":"id","in":"query","description":"ID of the archive to use the Plugin on. This is only mandatory for metadata plugins.","required":false,"schema":{"type":"string","minLength":40,"maxLength":40}},{"name":"plugin","in":"query","description":"Namespace of the plugin to use.","required":false,"schema":{"type":"string"}},{"name":"arg","in":"query","description":"Optional One-Shot argument to use when executing this Plugin.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Plugin result","content":{"application/json":{"schema":{"type":"object","properties":{"operation":{"type":"string","enum":["use_plugin"]},"type":{"type":"string","description":"Plugin type. Omitted when the plugin is not found.","enum":["download","login","metadata","script"]},"success":{"type":"integer","description":"Whether the Plugin run succeeded or not.","enum":[0,1]},"error":{"type":["string","null"]},"data":{"type":"object","description":"Arbitrary data returned by the Plugin."}}}}}}}}}}}
```

## 🔑 Use a Plugin Asynchronously

> Uses a Plugin and returns a Minion Job ID matching the Plugin run. This endpoint is useful if you want to run longer-lived plugins which might timeout if ran with the standard endpoint.<br>

```json
{"openapi":"3.1.0","info":{"title":"LANraragi API","version":"0.9.6"},"tags":[{"name":"plugins","description":"APIs to list and execute Plugins."}],"servers":[{"url":"https://lrr.tvc-16.science/api"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{"api_key":{"type":"apiKey","name":"Authorization","in":"header","description":"Use Authorization: Bearer <base64(api_key)>"}}},"paths":{"/plugins/queue":{"post":{"operationId":"usePluginAsync","summary":"🔑 Use a Plugin Asynchronously","description":"Uses a Plugin and returns a Minion Job ID matching the Plugin run. This endpoint is useful if you want to run longer-lived plugins which might timeout if ran with the standard endpoint.\n","tags":["plugins"],"parameters":[{"name":"id","in":"query","description":"ID of the archive to use the Plugin on. This is only mandatory for metadata plugins.","required":false,"schema":{"type":"string","minLength":40,"maxLength":40}},{"name":"priority","in":"query","required":false,"description":"Priority of the Minion job. The higher the number, the more important the job is.","schema":{"type":"integer","default":0}},{"name":"plugin","in":"query","description":"Namespace of the plugin to use.","required":false,"schema":{"type":"string"}},{"name":"arg","in":"query","description":"Optional One-Shot argument to use when executing this Plugin.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Enqueued job","content":{"application/json":{"schema":{"type":"object","properties":{"operation":{"type":"string","enum":["queue_plugin_exec"]},"success":{"type":"integer","enum":[0,1]},"job":{"type":"integer","description":"ID of the created Minion job"}}}}}}}}}}}
```


---

# 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://sugoi.gitbook.io/lanraragi/api-documentation/plugin-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.
