> For the complete documentation index, see [llms.txt](https://docs.mosip.io/1.2.0/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mosip.io/1.2.0/mosip-docs-1.1.5/apis/zone-apis.md).

# Zone APIs

This section details about the service APIs for the Zones

## Zone Master API

* [GET /zones/authorize/{rid}](#get-zones-authorize-rid)
* [GET /zones/hierarchy/{langCode}](#get-zones-hierarchy-langcode)
* [GET /zones/leafs/{langCode}](#get-zones-leafs-langcode)
* [GET /zones/zonename](#get-zones-zonename)

### GET /zones/authorize/{rid}

This service will verify if the logged-in user is authorized to view the RID history.

#### Resource URL

`GET /zones/authorize/{rid}`

#### Resource details

| Resource Details        | Description |
| ----------------------- | ----------- |
| Response format         | JSON        |
| Requires Authentication | Yes         |

#### Parameters

| Name | Required | Description                                  | Default Value | Example |
| ---- | -------- | -------------------------------------------- | ------------- | ------- |
| rid  | yes      | rid for which user wants to know the history |               |         |

#### Example Response

```
{
  "id": null,
  "version": null,
  "responsetime": "2020-07-08T06:08:26.654Z",
  "metadata": null,
  "response": true,
  "errors": null
}
```

### GET /zones/hierarchy/{langCode}

This service will fetch the logged-in user zone hierarchy.

#### Resource URL

`GET /zones/hierarchy/{langCode}`

#### Resource details

| Resource Details        | Description |
| ----------------------- | ----------- |
| Response format         | JSON        |
| Requires Authentication | Yes         |

#### Parameters

| Name     | Required | Description        | Default Value | Example |
| -------- | -------- | ------------------ | ------------- | ------- |
| langCode | yes      | user language code |               |         |

#### Example Response

```
{
  "id": null,
  "version": null,
  "responsetime": "2019-11-18T06:04:39.194Z",
  "metadata": null,
  "response": [
    {
      "isActive": true,
      "createdBy": "superadmin",
      "createdDateTime": "2019-08-27T12:28:10.549Z",
      "updatedBy": null,
      "updatedDateTime": null,
      "isDeleted": null,
      "deletedDateTime": null,
      "code": "STT",
      "langCode": "eng",
      "name": "Settat",
      "hierarchyLevel": 3,
      "hierarchyName": "Province",
      "parentZoneCode": "CST",
      "hierarchyPath": "MOR/NTH/CST/STT"
    }
  ],
  "errors": []
}
```

### GET /zones/leafs/{langCode}

This service will fetch the logged-in user zone hierarchy leaf zones.

#### Resource URL

`GET /zones/leafs/{langCode}`

#### Resource details

| Resource Details        | Description |
| ----------------------- | ----------- |
| Response format         | JSON        |
| Requires Authentication | Yes         |

#### Parameters

| Name     | Required | Description        | Default Value | Example |
| -------- | -------- | ------------------ | ------------- | ------- |
| langCode | yes      | user language code |               |         |

#### Example Response

```
{
  "id": null,
  "version": null,
  "responsetime": "2019-11-18T06:09:15.321Z",
  "metadata": null,
  "response": [
    {
      "isActive": true,
      "createdBy": "superadmin",
      "createdDateTime": "2019-08-27T12:28:10.549Z",
      "updatedBy": null,
      "updatedDateTime": null,
      "isDeleted": null,
      "deletedDateTime": null,
      "code": "BSN",
      "langCode": "eng",
      "name": "Benslimane",
      "hierarchyLevel": 3,
      "hierarchyName": "Province",
      "parentZoneCode": "CST",
      "hierarchyPath": "MOR/NTH/CST/BSN"
    }
  ],
  "errors": []
}
```

### GET /zones/zonename

This service will fetch the logged-in user zone hierarchy leaf zones.

#### Resource URL

`GET /zones/zonename`

#### Resource details

| Resource Details        | Description |
| ----------------------- | ----------- |
| Response format         | JSON        |
| Requires Authentication | Yes         |

#### Parameters

| Name     | Required | Description        | Default Value | Example |
| -------- | -------- | ------------------ | ------------- | ------- |
| langCode | yes      | user language code |               |         |
| userID   | yes      | user id            |               |         |

#### Example Response

```
{
  "id": null,
  "version": null,
  "responsetime": "2019-11-18T06:22:22.475Z",
  "metadata": null,
  "response": {
    "zoneName": "Casablanca-Settat"
  },
  "errors": []
}
```

## Failure details

| Error Code  | Error Message                                       | Error Description |
| ----------- | --------------------------------------------------- | ----------------- |
| KER-MSD-337 | Error occured while fetching zone                   | Fetch Issue       |
| KER-MSD-339 | No zone found for the logged-in user                | Data Not Found    |
| KER-MSD-338 | Error Occured while fetching zone of the user       | Fetch Issue       |
| KER-MSD-391 | Entity for user ID specified Not Found              | Data Not Found    |
| KER-MSD-392 | Entity for Zone Code of user ID specified Not Found | Data Not Found    |
| KER-MSD-393 | Internal Server Error                               | Dependency issue  |


---

# 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.mosip.io/1.2.0/mosip-docs-1.1.5/apis/zone-apis.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.
