# Get the grant list detail

Information on specific grant can be obtained through this API.

## Request

Facts | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/admin/v1/badges/:badge_id/grants/:grant_id
HTTP Method | GET
Rate Limit | [100 per minute](https://open.feishu.cn/document/ukTMukTMukTM/uUzN04SN3QjL1cDN)
Supported app types | Custom App、Store App
Required scopes<br>**To use this API, you must have at least 1 of the listed scopes.** | View, create, update, and delete the list of members winning badge(admin:badge.grant)
Required field scopes | **Notice**：The response body of the API contains the following sensitive fields, and they will be returned only after corresponding scopes are added. If you do not need the fields, it is not recommended that you request the scopes.<br>Obtain user ID(contact:user.employee_id:readonly)

### Request header

Parameter | Type | Required | Description
---|---|---|---
Authorization | string | Yes | `tenant_access_token`<br>**Value format**: "Bearer `access_token`"<br>**Example value**: "Bearer t-7f1bcd13fc57d46bac21793a18e560"<br>[How to choose and get access token](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-choose-which-type-of-token-to-use)

### Path parameters

Parameter | Type | Description
---|---|---
badge_id | string | A unique identifier of a medal within a tenant, randomly generated by the system.<br>**Example value**: "m_DjMzaK"<br>**Data validation rules**:<br>- Length range: `1` ～ `64` characters
grant_id | string | A unique identifier of a grant list within a tenant, randomly generated by the system.<br>**Example value**: "g_uS4yux"<br>**Data validation rules**:<br>- Length range: `1` ～ `64` characters

### Query parameters

Parameter | Type | Required | Description
---|---|---|---
user_id_type | string | No | User ID categories<br>**Example value**: "open_id"<br>**Optional values are**:<br>- open_id：Identifies a user to an app. The same user has different Open IDs in different apps. [How to get Open ID](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-obtain-openid)<br>- union_id：Identifies a user to a tenant that acts as a developer. A user has the same Union ID in apps developed by the same developer, and has different Union IDs in apps developed by different developers. A developer can use Union ID to link the same user's identities in multiple apps.[How to get Union ID](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-obtain-union-id)<br>- user_id：Identifies a user to a tenant. The same user has different User IDs in different tenants. In one single tenant, a user has the same User ID in all apps （including store apps）. User ID is usually used to communicate user data between different apps. [How to get User ID](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-obtain-user-id)<br>**Default value**: `open_id`<br>**When the value is `user_id`, the following field scopes are required**:<br>Obtain user ID(contact:user.employee_id:readonly)
department_id_type | string | No | The type of department ID used in this call.<br>**Example value**: "open_department_id"<br>**Optional values are**:<br>- department_id：Identify departments with custom department_id.<br>- open_department_id：Identify departments by open_department_id.<br>**Default value**: `open_department_id`

## Response

### Response body

Parameter | Type | Description
---|---|---
code | int | Error codes, fail if not zero
msg | string | Error descriptions
data | \- | \-
grant | grant | Grant information.
id | string | A unique identifier of a grant list within a tenant, randomly generated by the system.
badge_id | string | Unique ID for the enterprise badge
name | string | Grant list names, up to 100 characters.
grant_type | int | Grant List Type<br>**Optional values are**:<br>- 0：Manually select valid period<br>- 1：Matching system date of employment
time_zone | string | The time zone corresponding to the effective time of the grant list, used to check whether the value of RuleDetail's timestamp is standardized, and the value range is TZ database name.
rule_detail | rule_detail | Rules Details
effective_time | string | The timestamp that takes effect. 1. Manually set the valid period type badge, the configuration validity period needs to configure this field; 2. timestamp must be the zero point timestamp of the day in the time zone, such as 1649606400 when the time zone is Asia/Shanghai time zone.
expiration_time | string | The timestamp that ends in effect. 1. Manually set the valid period type badge, the configuration validity period needs to configure this field; 2. Maximum value: no more than effective_time + 100 years; 3. Non-permanent valid: timestamp must be 23:59:59 timestamp on the day of the time zone, such as 1649692799 when the time zone is Asia/Shanghai time zone; 4. Permanent valid: pass the value as 0.
anniversary | int | Onboarding anniversary. Depending on the date of employment, this field needs to be configured.
effective_period | int | Validity period. Depending on the date of employment, this field needs to be configured.<br>**Optional values are**:<br>- 1：Valid period is one year<br>- 2：Permanently valid
is_grant_all | boolean | Whether to grant to all employees. 1. When false, 1 to 500 client bases need to be associated. 2. When true, users, user groups, and departments cannot be associated.
user_ids | string\[\] | Granted user ID list, this field is not returned in the return result of the grant list list interface, but only returned in the detail API.
department_ids | string\[\] | List of granted department IDs, this field is not returned in the return result of the grant list list interface, but only returned in the detail API.
group_ids | string\[\] | Granted user group ID list, this field is not returned in the return result of the grant list list interface, but only returned in the details API.

### Response body example
```json
{
    "code": 0,
    "msg": "success",
    "data": {
        "grant": {
            "id": "g_49Z7CQ",
            "badge_id": "m_qTR2HM",
            "name": "Incentive badge grant list.",
            "grant_type": 0,
            "time_zone": "Asia/Shanghai",
            "rule_detail": {
                "effective_time": "1649606400",
                "expiration_time": "1649692799",
                "anniversary": 1,
                "effective_period": 1
            },
            "is_grant_all": false,
            "user_ids": [
                "u273y71"
            ],
            "department_ids": [
                "h121921"
            ],
            "group_ids": [
                "g122817"
            ]
        }
    }
}
```

### Error code

HTTP status code | Error code | Description | Troubleshooting suggestions
---|---|---|---
500 | 1051000 | unknown server error | Service internal error, please try again later
400 | 1051001 | request contain invalid param | Request contain invalid param
403 | 1051002 | request to exceed authority | Request to exceed authority
400 | 1051113 | cannot find this badge | No information found for this badge
400 | 1051205 | cannot find this grant | No information found for this grant list
403 | 1051003 | the tenant's current payment plan does not support the use of this function | Confirm the current tenant package, or upgrade the current package.

