Cannot upload approval attachment with user identity — /approval/v4/files/upload rejects user_access_token
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 17.3k
- Forks
- 1.4k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 105
Description
Summary
When running lark-cli in a UAT-only (user identity) build, it is impossible to upload attachments for approval instances via the API. The approval file upload endpoint /open-apis/approval/v4/files/upload rejects user_access_token, so any workflow that needs to create an approval instance with an attachmentV2 widget cannot be completed end-to-end through the CLI.
Environment
lark-cliversion: v1.0.88 (also checked latest v1.0.89, no relevant changes)- Build type: UAT-only (
--as botis rejected with--as bot is not permitted in this build (UAT-only)) - OS: macOS
- Command path:
lark-cli api POST /open-apis/approval/v4/files/upload
Reproduction
- Attempt to upload a file as an approval attachment with user identity:
lark-cli api POST /open-apis/approval/v4/files/upload \
--as user \
--file "file=./report.pdf" \
--params '{"name":"report.pdf","parent_type":"approval"}'
- The server returns:
{
"code": 99991668,
"msg": "user access token not support"
}
- Since the build is UAT-only, switching to
--as botis also rejected:
--as bot is not permitted in this build (UAT-only)
- Without a valid file
code, creating an approval instance with a requiredattachmentV2widget fails withvalidate form error 控件值不合法或者为空.
Root Cause
The Feishu/Lark Open Platform endpoint /approval/v4/files/upload only accepts tenant_access_token (bot identity), not user_access_token (user identity). This is an API-level limitation, not a CLI bug. However, the impact on CLI users is significant because:
- Many agent/automation environments (including the official UAT-only build) only have user identity available.
- The
lark-approvalskill documentation explicitly states that attachment file codes must be provided by the user and cannot be obtained through the CLI. - This forces users to manually create approval instances in the Feishu client whenever an attachment is required, breaking automation workflows.
Expected Behavior
One or more of the following would resolve this:
- CLI-level workaround: Provide a documented alternative path to obtain an approval attachment file code with user identity (e.g., via
drive/v1/medias/upload_allwith a specificparent_type, if the approval API accepts drive media tokens). - Shortcut command: Add an
approval +upload-attachmentshortcut that handles the identity requirement transparently (or clearly documents that bot identity is required). - Documentation: Explicitly document this limitation in the
lark-approvalskill and CLI help, including the error code99991668and the recommended workaround (manual creation in the Feishu client). - Upstream advocacy: Advocate to the Feishu Open Platform team to support
user_access_tokenfor the approval file upload endpoint, consistent with how IM file uploads already support user identity (see v1.0.13 changelog).
Actual Behavior
- Approval attachment upload fails with
user access token not support(code 99991668) when using user identity. - Bot identity is unavailable in UAT-only builds.
- No CLI shortcut exists for approval attachment uploads (unlike Base attachments, Task attachments, and IM file uploads, which all have dedicated shortcuts).
- The limitation is not clearly documented in the approval skill references.
Workaround
Manually create the approval instance in the Feishu/Lark desktop or web client and upload the attachment through the UI. This breaks automation but is the only reliable path when only user identity is available.
Related
- Issue #729 (approval attachment filename preservation) — related but distinct; that issue assumes bot identity is available.
- PR #730 (fix: preserve filenames for file uploads)
- v1.0.13: IM file upload supports user identity — demonstrates that user-identity file uploads are feasible for other domains.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the lark-cli api POST /open-apis/approval/v4/files/upload path and the lark-approval skill references. Confirm the user-token error and compare the documented upload options, then define whether the result is a CLI workaround, shortcut, or explicit limitation documentation; completion should leave user-identity workflows with a documented, reliable outcome.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, cli, documentation
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100