[DOCS]: Cannot use https://api.dify.ai/v1 baseurl api for posting segment adding request #263

Closed
opened 2026-02-16 05:19:39 -05:00 by yindo · 1 comment
Owner

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

  • I agree to follow Dify's documentation contribution guidelines
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.
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 - [x] I agree to follow Dify's documentation [contribution guidelines](https://github.com/langgenius/dify/blob/0277a37fcad5ad86aeb239485c27fffd5cd90043/CONTRIBUTING.md) - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields.
yindo added the documentation label 2026-02-16 05:19:39 -05:00
yindo closed this issue 2026-02-16 05:19:39 -05:00
Author
Owner

@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  Join Discord Share on X

@dosubot[bot] commented on GitHub (Nov 5, 2025): <!-- Greeting --> Hi @ThomosShen! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify-docs team. <!-- Answer --> 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](https://github.com/langgenius/dify/discussions/26265) and [this issue](https://github.com/langgenius/dify/issues/15706). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/359942a5-4c20-493b-99e2-15b2c92b4d7d?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/359942a5-4c20-493b-99e2-15b2c92b4d7d?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/359942a5-4c20-493b-99e2-15b2c92b4d7d?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/359942a5-4c20-493b-99e2-15b2c92b4d7d?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/359942a5-4c20-493b-99e2-15b2c92b4d7d?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/359942a5-4c20-493b-99e2-15b2c92b4d7d?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/359942a5-4c20-493b-99e2-15b2c92b4d7d?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify-docs/issues/512)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-docs#263