> For the complete documentation index, see [llms.txt](https://koii-network.gitbook.io/getting-started/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://koii-network.gitbook.io/getting-started/microservices-and-tasks/task-development-guide/executable-structure/api-endpoints-optional.md).

# API Endpoints (Optional)

You can define your own express API endpoints by extending the namespace express function. You can then call these endpoints to get data needed to validate a node or as an endpoint for a web application. This would be defined at the bottom of your executable. An example of an API endpoint is listed below:

```javascript
if (namespace.app) {
  namespace.express('post', '/accept-cid', async (req, res) => {
        const cid = req.body.cid;
        const result = dosomething(cid)
        res.status(200).json({ message: 'cid added to the submission list' });
  })
}
```
