> For the complete documentation index, see [llms.txt](https://developers-apps-in-toss.toss.im/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers-apps-in-toss.toss.im/api/zh/sdk.md).

# 数据 SDK

## 查询基于同意的用户数据

> 检查在迷你应用中登记的基于同意的用户数据项的用户同意状态。如果用户已同意最新的同意内容，则返回实际数据值；如果尚未同意或拒绝同意，则返回可跳转到同意页面的 URL，而不是数据。\
> \
> \### 业务错误代码\
> \
> 以下错误会与 HTTP 200 和 \`resultType: FAIL\`一起返回。\
> \
> \| errorCode | 说明       |\
> \| --------- | -------- |\
> \| \`4010\`    | 找不到认证信息。 |

```json
{"openapi":"3.1.0","info":{"title":"Apps in Toss 合作伙伴 API","version":"1.0.0"},"tags":[{"description":"这是合作方在查询已获得用户同意的个人信息时使用的 API。","name":"sdk"}],"servers":[{"description":"运营（简易登录·消息发送·Toss 积分发放等）","url":"https://apps-in-toss-api.toss.im"}],"security":[{"mutualTLS":[]}],"components":{"securitySchemes":{"mutualTLS":{"description":"这是基于发给合作伙伴的客户端证书的 mTLS 认证。通过证书的 CN 识别迷你应用。证书签发·管理方法请参考 [使用服务器 API](https://developers-apps-in-toss.toss.im/documentation/integration/server-api) 文档。","type":"mutualTLS"}},"schemas":{"DataSdkConsentedUserDataRequest":{"description":"这是基于同意的用户数据查询请求体。","properties":{"consentedUserDataKey":{"description":"这是用于识别要查询的基于同意的用户数据项的 key。在合作伙伴工作区控制台注册基于同意的用户数据项后会发放。","type":"string"}},"required":["consentedUserDataKey"]},"TossApiSuccessDataSdkConsentedUserDataResponse":{"description":"这是成功响应封装。","properties":{"resultType":{"description":"这是处理结果。成功时 `SUCCESS`。","enum":["SUCCESS"],"type":"string"},"success":{"$ref":"#/components/schemas/DataSdkConsentedUserDataResponse"}},"required":["resultType","success"],"type":"object"},"DataSdkConsentedUserDataResponse":{"description":"这是基于同意的用户数据查询结果。 `type` 根据值不同，实际返回的字段也会不同。","discriminator":{"propertyName":"type"},"oneOf":[{"$ref":"#/components/schemas/Provided"},{"$ref":"#/components/schemas/UserNotConsented"},{"$ref":"#/components/schemas/UserDeclined"},{"$ref":"#/components/schemas/TermsNotSet"},{"$ref":"#/components/schemas/Unavailable"}],"properties":{"type":{"description":"这是表示响应结果类型的判别值。","enum":["PROVIDED","USER_NOT_CONSENTED","USER_DECLINED","TERMS_NOT_SET","UNAVAILABLE"],"type":"string"}},"required":["type"]},"Provided":{"allOf":[{"$ref":"#/components/schemas/DataSdkConsentedUserDataResponse"},{"properties":{"data":{"additionalProperties":{"type":"string"},"description":"这是已同意的数据项的实际值。键是数据项（DataScopeKey），值是要在页面上显示的字符串。","type":"object"}},"type":"object"}],"description":"这是用户同意最新同意内容后，提供所请求项目实际数据值的响应。","required":["data","type"]},"UserNotConsented":{"allOf":[{"$ref":"#/components/schemas/DataSdkConsentedUserDataResponse"},{"properties":{"termsUrl":{"description":"这是用户可同意的同意页面 URL。","type":"string"}},"type":"object"}],"description":"用户尚未对是否同意作出回应。 `termsUrl`请通过该 URL 引导到同意页面。","required":["termsUrl","type"]},"UserDeclined":{"allOf":[{"$ref":"#/components/schemas/DataSdkConsentedUserDataResponse"},{"properties":{"termsUrl":{"description":"这是用户可重新同意的同意页面 URL。","type":"string"}},"type":"object"}],"description":"用户已明确拒绝同意。 `termsUrl`可通过该 URL 重新引导到同意页面。","required":["termsUrl","type"]},"TermsNotSet":{"allOf":[{"$ref":"#/components/schemas/DataSdkConsentedUserDataResponse"}],"description":"用于在同意页面展示的条款 URL 还未设置，因此目前无法告知您是否同意。","required":["type"]},"Unavailable":{"allOf":[{"$ref":"#/components/schemas/DataSdkConsentedUserDataResponse"}],"description":"由于临时错误等原因，无法确认用户同意状态。","required":["type"]},"TossApiFail":{"description":"这是失败响应封装。业务错误会以 HTTP 200 返回，所以 `resultType`请务必确认。","properties":{"error":{"$ref":"#/components/schemas/TossApiError"},"resultType":{"description":"这是处理结果。 `SUCCESS`除 SUCCESS 之外的值都请视为失败处理。通常 `FAIL`。","enum":["FAIL","HTTP_TIMEOUT","NETWORK_ERROR","EXECUTION_FAIL","INTERRUPTED","INTERNAL_ERROR"],"type":"string"},"success":{"description":"失败时始终为 null。"}},"required":["error","resultType"],"type":"object"},"TossApiError":{"description":"这是错误详细信息。","properties":{"data":{"description":"这是错误附加信息。请求限额超出时 `retryAfterSeconds`会包含其中。","type":"object"},"errorCode":{"description":"这是错误代码。请参考各 API 的业务错误代码表。","type":"string"},"errorType":{"description":"这是内部错误分类值。错误区分时 `errorCode`请用于错误区分。","format":"int32","type":"integer"},"reason":{"description":"这是人类可读的错误说明。","type":"string"},"title":{"description":"这是错误标题。大多为 null。","type":"string"}},"required":["errorCode","reason"],"type":"object"},"TossApiValidationFail":{"description":"这是请求字段验证失败时的响应。","properties":{"error":{"$ref":"#/components/schemas/TossApiValidationFailError"},"resultType":{"description":"这是处理结果。 `SUCCESS`除 SUCCESS 之外的值都请视为失败处理。通常 `FAIL`。","enum":["FAIL","HTTP_TIMEOUT","NETWORK_ERROR","EXECUTION_FAIL","INTERRUPTED","INTERNAL_ERROR"],"type":"string"},"success":{"description":"失败时始终为 null。"}},"required":["error","resultType"],"type":"object"},"TossApiValidationFailError":{"description":"这是错误详细信息。","properties":{"data":{"description":"这是错误附加信息。请求限额超出时 `retryAfterSeconds`会包含其中。","properties":{"errorDetails":{"description":"这是按字段划分的验证失败详情列表。","items":{"$ref":"#/components/schemas/TossApiFieldError"},"type":"array"}},"type":"object"},"errorCode":{"description":"这是错误代码。请参考各 API 的业务错误代码表。","type":"string"},"errorType":{"description":"这是内部错误分类值。错误区分时 `errorCode`请用于错误区分。","format":"int32","type":"integer"},"reason":{"description":"这是人类可读的错误说明。","type":"string"},"title":{"description":"这是错误标题。大多为 null。","type":"string"}},"required":["errorCode","reason"],"type":"object"},"TossApiFieldError":{"description":"这是按字段划分的验证失败详情列表。","properties":{"field":{"description":"这是验证失败的字段名。","type":"string"},"message":{"description":"这是验证失败原因。","type":"string"},"rejectedValue":{"description":"这是被拒绝的输入值。"}},"type":"object"}}},"paths":{"/api-partner/v1/apps-in-toss/data-sdk/get-consented-user-data":{"post":{"description":"检查在迷你应用中登记的基于同意的用户数据项的用户同意状态。如果用户已同意最新的同意内容，则返回实际数据值；如果尚未同意或拒绝同意，则返回可跳转到同意页面的 URL，而不是数据。\n\n### 业务错误代码\n\n以下错误会与 HTTP 200 和 `resultType: FAIL`一起返回。\n\n| errorCode | 说明       |\n| --------- | -------- |\n| `4010`    | 找不到认证信息。 |","operationId":"getConsentedUserData","parameters":[{"description":"这是用于认证用户的密钥。 [获取用户信息](https://developers-apps-in-toss.toss.im/documentation/api/toss-login#get-api-partner-v1-apps-in-toss-user-oauth2-login-me) 可以通过 API 获取","in":"header","name":"x-toss-user-key","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataSdkConsentedUserDataRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"discriminator":{"mapping":{"FAIL":"#/components/schemas/TossApiFail","SUCCESS":"#/components/schemas/TossApiSuccessDataSdkConsentedUserDataResponse"},"propertyName":"resultType"},"oneOf":[{"$ref":"#/components/schemas/TossApiSuccessDataSdkConsentedUserDataResponse"},{"$ref":"#/components/schemas/TossApiFail"}]}}},"description":"这是请求处理结果。 `resultType` 请通过值区分成功/失败。"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TossApiValidationFail"}}},"description":"请求正文格式不正确。 `error.data.errorDetails`请在此查看各字段详情。"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TossApiFail"}}},"description":"分类未明的服务器错误。若持续失败，请联系合作伙伴支持渠道。"}},"summary":"查询基于同意的用户数据","tags":["sdk"]}}}}
```


---

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developers-apps-in-toss.toss.im/api/zh/sdk.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
