Skip to content

批量创建经常性支付记录

根据传入的参数,校验并创建经常性支付记录,返回创建失败的原因或创建成功的数据ID

请求

项目
HTTP URLhttps://open.feishu.cn/open-apis/compensation/v1/recurring_payment/batch_create
HTTP MethodPOST
接口频率限制10 次/秒
支持的应用类型custom
权限要求 调用该 API 所需的权限。开启其中任意一项权限即可调用corehr:compensation.recurring_payment:write 经常性支付记录写权限
字段权限要求> Tip: 该接口返回体中存在下列敏感字段,仅当开启对应的权限后才会返回;如果无需获取这些字段,则不建议申请 contact:user.employee_id:readonly 获取用户 user ID

请求头

名称类型必填描述
Authorizationstringtenant_access_token 值格式:"Bearer access_token" 示例值:"Bearer t-7f1bcd13fc57d46bac21793a18e560" 了解更多:如何选择与获取 access token
Content-Typestring固定值:"application/json; charset=utf-8"

查询参数

名称类型必填描述
user_id_typestring用户 ID 类型
示例值:open_id
可选值有
- open_id: 标识一个用户在某个应用中的身份。同一个用户在不同应用中的 Open ID 不同。了解更多:如何获取 Open ID - union_id: 标识一个用户在某个应用开发商下的身份。同一用户在同一开发商下的应用中的 Union ID 是相同的,在不同开发商下的应用中的 Union ID 是不同的。通过 Union ID,应用开发商可以把同个用户在多个应用中的身份关联起来。了解更多:如何获取 Union ID? - user_id: 标识一个用户在某个租户内的身份。同一个用户在租户 A 和租户 B 内的 User ID 是不同的。在同一个租户内,一个用户的 User ID 在所有应用(包括商店应用)中都保持一致。User ID 主要用于在不同的应用间打通用户数据。了解更多:如何获取 User ID? - people_corehr_id: 以people_corehr_id来识别用户
默认值open_id
当值为 user_id,字段权限要求contact:user.employee_id:readonly 获取用户 user ID

请求体

名称类型必填描述
recordsrecurring_payment_for_create\[\]要创建的经常性支付记录
数据校验规则
- 长度范围:0500
  └ unique_idstring经常性支付记录 unique_id,unique_id 在创建时由上游指定
示例值:"7402510801304718380_7309316347007764012_7402523725868058156_1726070400000_10000"
数据校验规则
- 长度范围:0255 字符
  └ user_idstring员工id,具体类型由入参中的 user_id_type 指定
示例值:"7337149697626801708"
数据校验规则
- 长度范围:0255 字符
  └ item_idstring薪酬项 id(通过【查询薪酬项】) 接口进行查询)
示例值:"7411039006180312620"
数据校验规则
- 长度范围:0255 字符
  └ each_amountstring每次发放金额
示例值:"20.00"
数据校验规则
- 长度范围:0255 字符
  └ start_datestring发放开始时间
示例值:"2024-08-01"
数据校验规则
- 长度范围:0255 字符
  └ end_datestring发放结束时间
示例值:"2025-08-01"
数据校验规则
- 长度范围:0255 字符
  └ currency_idstring币种 id(通过【查询币种】) 接口进行查询)
示例值:"6863329932261459464"
数据校验规则
- 长度范围:0255 字符
  └ issuance_typestring发放方式
示例值:"with_salary"
可选值有
- with_salary: 随工资发放 - with_cash: 现金发放 - with_physical_distribution: 实物发放 - with_year_end_bonus: 随年终奖发放
  └ issuance_periodstring发放频率
示例值:"year"
可选值有
- year: 年 - half_year: 半年 - quarterly: 季度 - bimonthly: 双月 - month: 月 - biweekly: 双周 - week: 周 - day: 天 - hour: 小时
  └ remarkstring备注
示例值:"这是个备注"
数据校验规则
- 长度范围:03000 字符
  └ issuance_country_region_idstring发放国家id(可通过 https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/corehr-v2/basic_info-country_region/search进行查询)
示例值:"6862995745046267400"
数据校验规则
- 长度范围:0255 字符

请求体示例

json
{
    "records": [
        {
            "unique_id": "7402510801304718380_7309316347007764012_7402523725868058156_1726070400000_10000",
            "user_id": "7337149697626801708",
            "item_id": "7411039006180312620",
            "each_amount": "20.00",
            "start_date": "2024-08-01",
            "end_date": "2025-08-01",
            "currency_id": "6863329932261459464",
            "issuance_type": "with_salary",
            "issuance_period": "year",
            "remark": "这是个备注",
            "issuance_country_region_id": "6862995745046267400"
        }
    ]
}

响应

响应体

名称类型描述
codeint错误码,非 0 表示失败
msgstring错误描述
data\--
  └ operate_resultsrecurring_payment_operate_result\[\]每条记录的操作结果。对于创建成功的记录,会返回创建后的经常性支付记录id
    └ idstring操作记录的id
    └ unique_idstring操作的记录的 unique_id
    └ codeint操作结果状态码
可选值有
- 0: "Success" 操作成功 - 21280001: "The format of the single payment amount is incorrect" 单次发放金额格式不正确 - 21280002: "The format of the distribution start time is incorrect" 发放开始时间格式不正确 - 21280003: "The format of the issuance end time is incorrect" 发放结束时间格式不正确 - 21270304: "No permission for recurring payment record" 没有该经常性支付记录权限 - 21270305: "The recurring payment type salary item does not exist" 经常性支付类型薪酬项不存在 - 21270306: "The currency does not exist" 币种不存在 - 21270307: "The distribution method does not exist" 发放方式不存在 - 21270308: "The distribution start time is greater than the distribution end time" 发放开始时间大于发放结束时间 - 21270309: "Employees are not covered by the remuneration rules" 员工不在薪酬项规则适用范围之内 - 21270310: "The payment method does not match the salary item rules" 发放方式不匹配薪酬项规则 - 21270311: "Currency mismatch compensation item rules" 币种不匹配薪酬项规则 - 21270312: "The distribution start date is earlier than the current date and cannot be deleted" 发放开始日期早于当前日期不可删除 - 21270313: "The recurring payment record does not exist" 该经常性支付记录不存在 - 21270314: "Payment frequency does not match the salary item" 发放频率不匹配薪酬项 - 21270315: "The distribution start date and end date overlap" 发放开始日期和结束日期有重叠 - 21270316: "Issuing country is empty" 发放国家为空 - 21270317: "Issuing country does not exist" 发放国家不存在 - 21270318: "The single payment amount cannot be 0" 单次发放金额不允许为0
    └ messagestring操作结果描述

响应体示例

json
{
    "code": 0,
    "msg": "success",
    "data": {
        "operate_results": [
            {
                "id": "7390583861280556588",
                "unique_id": "7390583861280556588",
                "code": 21270202,
                "message": "uqniue id conflict"
            }
        ]
    }
}

错误码

HTTP状态码错误码描述排查建议
4002290001param is invalid参数异常,请检查入参
5002290002server error服务端异常,请稍后重试

内容来源:飞书开放平台 · 自动爬取整理