# Functions

Function registry

## GET /functions

> List registered functions

```json
{"openapi":"3.0.3","info":{"title":"Mimic Protocol API","version":"1.0.1"},"tags":[{"name":"Functions","description":"Function registry"}],"servers":[{"url":"https://api-protocol.mimic.fi"}],"paths":{"/functions":{"get":{"summary":"List registered functions","operationId":"getFunctions","tags":["Functions"],"parameters":[{"name":"cids","in":"query","description":"Comma-separated list of CIDs to filter by","schema":{"type":"string"}},{"name":"creator","in":"query","description":"Filter by creator EVM address","schema":{"$ref":"#/components/schemas/Address"}},{"$ref":"#/components/parameters/OffsetParam"},{"$ref":"#/components/parameters/LimitParam"}],"responses":{"200":{"description":"List of functions","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Function"}}}}}}}}},"components":{"schemas":{"Address":{"type":"string","description":"A valid EVM (0x-prefixed hex) address."},"Function":{"type":"object","required":["CID","name","version","description","createdAt"],"properties":{"CID":{"$ref":"#/components/schemas/CID"},"name":{"type":"string"},"version":{"type":"string"},"description":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}}},"CID":{"type":"string","description":"An IPFS content identifier (CIDv0 or CIDv1 base32)."}},"parameters":{"OffsetParam":{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0}},"LimitParam":{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":10}}}}}
```

## Upload a new function

> Uploads a function bundle. The request must be \`multipart/form-data\` containing exactly two files using the same multipart field name \`file\`. The filenames must be \`manifest.json\` and \`function.wasm\`.<br>

```json
{"openapi":"3.0.3","info":{"title":"Mimic Protocol API","version":"1.0.1"},"tags":[{"name":"Functions","description":"Function registry"}],"servers":[{"url":"https://api-protocol.mimic.fi"}],"security":[{"apiKeyAuth":[]}],"components":{"securitySchemes":{"apiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"API key obtained from `GET /users/api-key`"}},"schemas":{"Function":{"type":"object","required":["CID","name","version","description","createdAt"],"properties":{"CID":{"$ref":"#/components/schemas/CID"},"name":{"type":"string"},"version":{"type":"string"},"description":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}}},"CID":{"type":"string","description":"An IPFS content identifier (CIDv0 or CIDv1 base32)."},"Error":{"type":"object","properties":{"message":{"type":"string"}}}},"responses":{"BadRequest":{"description":"Bad request — invalid parameters or body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unauthorized":{"description":"Unauthorized — missing or invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/functions":{"post":{"summary":"Upload a new function","description":"Uploads a function bundle. The request must be `multipart/form-data` containing exactly two files using the same multipart field name `file`. The filenames must be `manifest.json` and `function.wasm`.\n","operationId":"createFunction","tags":["Functions"],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"array","minItems":2,"maxItems":2,"items":{"type":"string","format":"binary"},"description":"Exactly two uploaded files using the same multipart field name `file`. The filenames must be `manifest.json` and `function.wasm`.\n"}}}}}},"responses":{"200":{"description":"Function registered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Function"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"}}}}}}
```

## GET /functions/{cid}

> Get a function by CID

```json
{"openapi":"3.0.3","info":{"title":"Mimic Protocol API","version":"1.0.1"},"tags":[{"name":"Functions","description":"Function registry"}],"servers":[{"url":"https://api-protocol.mimic.fi"}],"paths":{"/functions/{cid}":{"get":{"summary":"Get a function by CID","operationId":"getFunction","tags":["Functions"],"parameters":[{"$ref":"#/components/parameters/CidParam"}],"responses":{"200":{"description":"Function details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Function"}}}},"404":{"$ref":"#/components/responses/NotFound"}}}}},"components":{"parameters":{"CidParam":{"name":"cid","in":"path","required":true,"schema":{"$ref":"#/components/schemas/CID"}}},"schemas":{"CID":{"type":"string","description":"An IPFS content identifier (CIDv0 or CIDv1 base32)."},"Function":{"type":"object","required":["CID","name","version","description","createdAt"],"properties":{"CID":{"$ref":"#/components/schemas/CID"},"name":{"type":"string"},"version":{"type":"string"},"description":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}}},"Error":{"type":"object","properties":{"message":{"type":"string"}}}},"responses":{"NotFound":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}
```


---

# 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.mimic.fi/developers/api/functions.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.
