> For the complete documentation index, see [llms.txt](https://docs.digit.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digit.org/platform/accelerators/checklists/api-checklist.md).

# API Checklist

## APIs - The Do's & Don'ts

The APIs developed on DIGIT adhere to specific conventions and principles. Below are the dos and don'ts to be observed when following these API principles.

1. Always define the Yaml for your APIs as the first thing using Open API 3 Standard (<https://swagger.io/specification/>).
2. APIs path should be standardised as follows:
   * **/{service}/{entity}/{version}/\_create**: This endpoint should be used to create the entity.
   * **/{service}/{entity}/{version}/\_update**: This endpoint should be used to edit an entity which is already existing.
   * **/{service}/{entity}/{version}/\_search**: This endpoint should be used to provide a search on the entity based on certain criteria.
   * **/{service}/{entity}/{version}/\_count**: This endpoint should be provided to give a count of entities that match the given search criteria.
3. Always use POST for each of the endpoints.
4. Take most search parameters in the POST body only.
5. If query params for search need to be supported then make sure to have the same parameters in the POST body also and the POST body should take priority over query params.
6. Provide additional detail for objects in **\_create** and **\_update** APIs so that custom requirements can use these fields.
7. Each API should have a [**RequestInfo**](https://github.com/egovernments/core-services/blob/4e92620bd77fce183fdd66d3a8d9248f65561ada/docs/common-contract.yml#L45) object in the request body at the top level.
8. Each API should have a [**ResponseInfo**](https://github.com/egovernments/core-services/blob/4e92620bd77fce183fdd66d3a8d9248f65561ada/docs/common-contract.yml#L154) object in the response body at the top level.
9. Mandatory fields should be the minimum for the APIs.
10. minLength and maxLength should be defined for each attribute.
11. Read-only fields should be called out.
12. Use common models already available in the platform in your APIs. Example -
    * [Address](https://github.com/egovernments/core-services/blob/4e92620bd77fce183fdd66d3a8d9248f65561ada/docs/common-contract.yml#L228)
    * [User](https://github.com/egovernments/core-services/blob/4e92620bd77fce183fdd66d3a8d9248f65561ada/docs/common-contract.yml#L96) (Citizen/ Employee/ Owner)
    * [Role](https://github.com/egovernments/core-services/blob/4e92620bd77fce183fdd66d3a8d9248f65561ada/docs/common-contract.yml#L130)
    * [AuditDetails](https://github.com/egovernments/core-services/blob/4e92620bd77fce183fdd66d3a8d9248f65561ada/docs/common-contract.yml#L270)
    * [ErrorRes](https://github.com/egovernments/core-services/blob/4e92620bd77fce183fdd66d3a8d9248f65561ada/docs/common-contract.yml#L213) (Response sent in case of errors)
    * TODO: Add all the models here
13. For receiving files in an API, do not use binary file data. Instead, accept the file store ids.
14. If there is only one file to be uploaded and no persistence is needed, and no additional JSON data is to be posted, you can consider using direct file upload instead of using filestore id.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.digit.org/platform/accelerators/checklists/api-checklist.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 `automate deployments from our CI pipeline` 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.
