更新于 2026-06-08如果你的应用需要使用应用权限点,无论是企业内部应用还是第三方企业应用,都应通过本接口获取应用级别的 Access Token。该凭证用于调用钉钉开放平台中受权限保护的 API 接口。
此接口用于获取企业内部应用或第三方企业应用调用API所需的Access Token,适用于所有需要通过应用身份鉴权调用钉钉开放平台接口的场景。
如果你之前使用:
企业内部应用:调用获取企业内部应用的accessToken接口,获取企业调用接口的凭证信息。
第三方企业应用:调用获取第三方应用授权企业的accessToken接口,获取第三方应用授权企业调用接口的凭证信息。
现在这两种场景统一为一个接口,无需区分应用类型,直接调用本接口即可获取 AccessToken 调用应用权限接口。
| 基本信息 | 基本信息 |
|---|---|
| HTTP URL | https://api.dingtalk.com/v1.0/oauth2/{corpId}/token |
| HTTP Method | POST |
| 支持的应用类型 | 企业内部应用第三方企业应用 |
| 权限要求 | 调用企业API时需要具备的基本权限 |
| 名称 | 类型 | 是否必填 | 示例值 | 描述 |
|---|---|---|---|---|
| corpId | String | 是 | ding9f****41 | 组织ID,应用运行在哪个组织就填写哪个组织的 corpId: |
企业内部应用:填写本企业 corpId。
第三方企业应用:填写开通应用的授权企业的 corpId。 |
| 名称 | 类型 | 是否必填 | 示例值 | 描述 |
|---|---|---|---|---|
| client_id | String | 是 | suite123 | 应用的 ClientID。 |
| client_secret | String | 是 | ******** | 应用的 ClientSecret。 |
| grant_type | String | 是 | client_credentials | 授权类型:client_credentials |
HTTP
1
2
3
4
5
6
7
8
9
POST /v1.0/oauth2/ding9f****41/token HTTP/1.1
Host:api.dingtalk.com
Content-Type:application/json
{
"client_id" : "suite123",
"client_secret" : "********",
"grant_type" : "client_credentials"
}
Enter to Rename, ⇧Enter to Preview
Java
1
// This file is auto-generated, don't edit it. Thanks.
Enter to Rename, ⇧Enter to Preview
Python
1
# -*- coding: utf-8 -*-
Enter to Rename, ⇧Enter to Preview
PHP
1
<?php
Enter to Rename, ⇧Enter to Preview
Go
1
// This file is auto-generated, don't edit it. Thanks.
Enter to Rename, ⇧Enter to Preview
Node.js
1
'use strict';
Enter to Rename, ⇧Enter to Preview
C#
1
// This file is auto-generated, don't edit it. Thanks.
Enter to Rename, ⇧Enter to Preview
| 名称 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| access_token | String | 2bf******9be361a508 |
访问凭证。 |
| expires_in | Integer | 7200 | 访问凭证有效的时长,单位秒。 |
1
2
3
4
5
6
7
HTTP/1.1 200 OK
Content-Type:application/json
{
"access_token" : "2bf******9be361a508",
"expires_in" : 7200
}
Enter to Rename, ⇧Enter to Preview
若调用该接口报错,可根据错误信息在全局错误码文档中查找解决方案。
| HttpCode | 错误码 | 错误信息 | 说明 |
|---|---|---|---|
| 400 | invalid.client | invalid.client | 无效的ClientID或ClientSecret |
| 400 | unsupported.grant.type | unsupported.grant.type | 不支持此授权类型,请检查授权类型参数 |
| 401 | unauthorized.client | unauthorized.client | 应用未被授权 |
| 500 | server.error | server.error | 服务器意外错误 |