You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用LinkedIn V2分片上传API完成视频上传时遇401错误

Troubleshooting 401 Error on LinkedIn V2 completeMultiPartUpload

It’s super frustrating when all your video parts upload smoothly but the final completion call throws a 401—let’s break down the most likely causes and fixes to get you past this roadblock:

1. Fix the URL Parameter Separator (Most Likely Culprit)

Looking at your curl command, the URL uses & to split the action and oauth2_access_token parameters:

"https://api.linkedin.com/v2/assets?action=completeMultiPartUpload&oauth2_access_token=xxxx"

& is an HTML entity for the & character. When curl sends this request, the server will treat &oauth2_access_token=xxxx as part of the action parameter’s value, not a separate parameter. That means your access token isn’t being passed correctly at all—hence the 401 unauthorized error.

Quick Fix: Replace & with a plain &:

curl -v -X POST -H "Content-Type:application/json" -H "X-RestLi-Protocol-Version:2.0.0" "https://api.linkedin.com/v2/assets?action=completeMultiPartUpload&oauth2_access_token=xxxx" --data '{"completeMultipartUploadRequest":{"metadata":"abcdhjf lmmfk45322jnmdfmndk","partUploadResponses":[{"httpStatusCod...'

2. Verify Your Access Token’s Validity & Scopes

Even if the token worked for part uploads, it might have expired or lack the right permissions for the completion call:

  • Check expiration: LinkedIn access tokens only last 60 minutes. If your part uploads dragged on longer than that, the token will be invalid by the time you call completeMultiPartUpload. Test your token with a quick sanity check:
    curl -H "Authorization: Bearer xxxx" https://api.linkedin.com/v2/me
    
    If this returns a 401, you’ll need to refresh or re-authenticate to get a fresh token.
  • Check required scopes: For personal video uploads, you must have the w_member_social scope. For organization-owned assets, make sure you have rw_organization_admin (and that the token is linked to the correct organization).

3. Switch to Using the Authorization Header (More Reliable)

Instead of passing the access token as a URL parameter, use the Authorization: Bearer header—this is LinkedIn’s recommended approach and avoids potential URL encoding headaches:

curl -v -X POST \
  -H "Content-Type: application/json" \
  -H "X-RestLi-Protocol-Version: 2.0.0" \
  -H "Authorization: Bearer xxxx" \
  "https://api.linkedin.com/v2/assets?action=completeMultiPartUpload" \
  --data '{"completeMultipartUploadRequest":{"metadata":"abcdhjf lmmfk45322jnmdfmndk","partUploadResponses":[{"httpStatusCod...'

4. Double-Check the Request Body Format

While a malformed body usually returns a 400 error, it’s worth ruling out:

  • Ensure partUploadResponses includes every part’s partNumber and the etag returned by each part upload call. Missing or incorrect values could trigger unexpected authorization errors in rare cases.
  • Confirm the metadata field matches the exact structure you used when initiating the multi-part upload—any mismatches might interfere with the completion process.

内容的提问来源于stack exchange,提问作者Rishikesan Varudharajan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 08:26:59