mirror of
https://github.com/langgenius/dify-docs.git
synced 2026-07-22 04:15:24 -04:00
[DOCS]: Cannot use https://api.dify.ai/v1 baseurl api for posting segment adding request #263
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ThomosShen on GitHub (Nov 5, 2025).
Type of Documentation Change
Error/Typo fix
Documentation Page URL or Path
https://api.dify.ai/v1/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}
Current Content
{
"code": "unauthorized",
"message": "Access token is invalid",
"status": 401
}
Suggested Changes
when I use trying it and add apikey and other parameters, it shows:
{
"code": "unauthorized",
"message": "Access token is invalid",
"status": 401
}
Reason for Change
No response
Code of Conduct
@dosubot[bot] commented on GitHub (Nov 5, 2025):
Hi @ThomosShen! I'm Dosu and I’m helping the dify-docs team.
The 401 "Access token is invalid" error for this endpoint usually means the API token is missing, expired, or not accepted in the required format. For write operations like posting or updating segments, you must use a user-scoped API token (not a dataset-scoped key), and include it in the Authorization header as
Bearer {api_key}—no curly braces or extra spaces. Dataset-scoped keys only allow read access and will not work for this endpoint. Double-check that you are using the correct token type, that it has editor or operator permissions, and that your URL replaces all{}placeholders with actual IDs. If you still see this error, verify the token is not expired and that your account is active and authorized for the dataset. For more details, see this discussion and this issue.To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
