> For the complete documentation index, see [llms.txt](https://docs.mimic.fi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mimic.fi/developers/api/functions.md).

# 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"}}}}}}}
```
