Uh oh!
There was an error while loading. Please reload this page.
docs: Document repository API token creation and scope OD-395 - #2725
docs: Document repository API token creation and scope OD-395#2725pedrobpereira wants to merge 7 commits into
Conversation
Overall readability score: 53.81 (🟢 +0.02)
View detailed metrics🟢 - Shows an increase in readability
Averages:
View metric targets
|
Up to standards ✅🟢 Issues |
fd791d7 to
5234b79Compare5234b79 to
8b7d7baCompareCover name rules, mandatory 1-year expiry, the 13 allowed operations, and expired-token handling for repository tokens. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
8b7d7ba to
fdebbb4CompareThere was a problem hiding this comment.
Pull Request Overview
The documentation updates generally align with the requirements for detailing Repository API token creation and scoping. However, the PR fails to document that token values remain fully visible (not masked) after creation, a detail explicitly mentioned in the PR intent. Additionally, the phrasing in some sections could lead to confusion between the restricted scope of API v3 tokens versus legacy API v2 behavior. Codacy results indicate the PR is up to standards with no new quality issues.
About this PR
- The PR description indicates that documentation would include a note about the token value staying 'fully visible after creation (not masked)', but this information is absent from the repository API tokens section.
Test suggestions
- Verify documentation of naming constraints for repository tokens.
- Verify documentation of the 1-year maximum expiration and absence of 'never-expire' option.
- Verify documentation of the 13 specific authorized operations for API v3.
- Verify documentation that legacy tokens without expiry are grandfathered.
- Verify mention of 'token value stays fully visible after creation (not masked)'
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Verify mention of 'token value stays fully visible after creation (not masked)'
TIP Improve review quality by adding custom instructionsTIP How was this review? Give us feedback
| 1. Click the button **Create API token** under **Repository API tokens**. | ||
| - Optionally give the token a name. Names may contain only letters, numbers, and dashes, up to 100 characters. If you don't set a name, Codacy generates one for you. |
There was a problem hiding this comment.
🟡 MEDIUM RISK
The PR description mentions that the documentation should state 'the token value stays fully visible after creation (not masked)'. This information is missing from this section of the diff.
| ### What repository API tokens can do on API v3 {: id="repository-api-token-operations"} | ||
| On **API v3**, a repository API token authorizes only the following operations, and only on the repository it was created for. This restriction doesn't apply to **API v2**, where a repository API token can access any endpoint for its repository: |
There was a problem hiding this comment.
🟡 MEDIUM RISK
Suggestion: The current phrasing suggests the following list applies to API v2, while it actually describes the restricted set for API v3.
| On **API v3**, a repository API token authorizes only the following operations, and only on the repository it was created for. This restriction doesn't apply to **API v2**, where a repository API token can access any endpoint for its repository: | |
| On **API v3**, a repository API token authorizes only the following operationson the repository it was created for (unlike the legacy **API v2**, which allows access to all endpoints for that repository): |
| Performing `GET` requests for public repositories doesn't require authentication. | ||
| !!! note | ||
| Repository API tokens always have an expiration date (up to one year). A request authenticated with an expired repository API token is rejected with a distinct "token expired" error, rather than the generic error you'd get from an invalid or unknown token — see [repository API tokens](api-tokens.md#repository-api-tokens). |
There was a problem hiding this comment.
⚪ LOW RISK
Suggestion: This statement is too absolute and contradicts the legacy token exception mentioned in the main documentation. Adding a qualifier improves accuracy.
| Repository API tokens always have an expiration date (up to one year). A request authenticated with an expired repository API token is rejected with a distinct "token expired" error, rather than the generic error you'd get from an invalid or unknown token — see [repository API tokens](api-tokens.md#repository-api-tokens). | |
| New repository API tokens always have an expiration date (up to one year). A request authenticated with an expired repository API token is rejected with a distinct "token expired" error, rather than the generic error you'd get from an invalid or unknown token — see [repository API tokens](api-tokens.md#repository-api-tokens). |
- Repository token names are unique per repository (confirmed by Andrzej Janczak), not just character-restricted. - The Codacy Cloud CLI doesn't currently support repository tokens (confirmed by Andrzej Janczak) — the intro list implied it did for both token types. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…D-395 Add screenshots for the repository API token flow: the create modal, the custom date option, the newly created token, the bulk delete, and a repository with a token that never expires. Replace the account API token screenshots, which no longer matched the UI. Correct the parts of the page the new screenshots contradicted: - Repository API tokens are under Settings > API tokens, not Integrations. - Account API tokens can no longer be created without an expiration date, and are capped at one year like repository tokens. - Tokens are revoked with the trash icon in the Actions column, or in bulk by selecting them and clicking Delete tokens. - Document that the token value is shown only once, immediately after creation. Add a recommendation to replace tokens without an expiration date, in both sections, including the order to follow so that live integrations don't break. Remove two images that no longer have any reference and no longer match the UI: codacy-api-tokens-account.png and codacy-api-tokens-repository.png. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
| - Upload to Codacy the results of [running client-side analysis tools](../repositories-configure/local-analysis/client-side-tools.md) | ||
| - [Authenticate when using the Codacy API](using-the-codacy-api.md#authenticating-requests) | ||
| - [Authenticate with the Codacy Cloud CLI](../codacy-cloud-cli/index.md#authentication) | ||
| - [Authenticate with the Codacy Cloud CLI](../codacy-cloud-cli/index.md#authentication) (account API tokens only — the Codacy Cloud CLI doesn't currently support repository API tokens) |
There was a problem hiding this comment.
Good catch, you're right. OD-489 is Done (13 Aug) and codacy-cloud-cli#37 "feat: Add repository (project) token support" merged on the 11th, so the CLI does support repository tokens now. Claim removed in 8182527.
There was a problem hiding this comment.
Done in 69944d2 — and you were right to push back. Deleting the sentence made the page silent rather than correct: the Codacy Cloud CLI page it links to still documented account API tokens only, so there was nowhere saying repository tokens work.
That section now covers, from codacy-cloud-cli v1.9.0:
- the option
--repository-tokenand theCODACY_PROJECT_TOKENenvironment variable, and thatcodacy loginonly accepts account API tokens - the precedence:
--repository-token>CODACY_PROJECT_TOKEN>CODACY_API_TOKEN> stored credentials - that commands outside the operations a repository token authorizes fail immediately rather than returning an Unauthorized error, and that
codacy repositoryomits pull request and coverage data, listing them underunavailablein its JSON output
Uh oh!
There was an error while loading. Please reload this page.
|  | ||
| !!! important |
There was a problem hiding this comment.
can you ask claude to update the branch to master and review the PR according to the formatting rules? XD im wondering how many admonitions we have here and how many we need
There was a problem hiding this comment.
Branch updated from master.
On admonitions: the page has 4 in the file, plus one pulled in from assets/includes/api-token-warning.md. The two !!! important blocks added along with the screenshots were the extra weight, so the account-level one is now a plain paragraph and this one is back to !!! note, as it was before. Net admonitions added by this PR: zero. Vale passes.
There was a problem hiding this comment.
Why is the name blurred here but not blurred on the other screen docs/codacy-api/images/codacy-api-tokens-repository-bulk-delete.png
There was a problem hiding this comment.
Fixed by unblurring this one in 8182527. pt-caa4da16ab2e is a generated name rather than a token value, so it belongs in the same category as the names in the bulk delete screenshot. The only thing still pixelated is the actual token value in the created-token screenshot, which does need to stay that way.
- The Codacy Cloud CLI does support repository API tokens since OD-489 shipped, so drop the claim that it doesn't. - Reword the notes on tokens created before expiration dates became mandatory, following Claudia's suggestion. - Turn the account-level note into a paragraph and the repository one back into a note, so the page keeps the same number of admonitions it had before the screenshots were added. - Stop blurring the token name in the never-expires screenshot: it's a generated name rather than a token value, and it was inconsistent with the bulk delete screenshot, which shows names unblurred. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
LipeGheno
commented
Aug 14, 2026
One open question, since it predates this PR and I couldn't settle it from screenshots: the account section still says "By hovering a token, you are able to copy its value." The account tokens table now masks the value ( |
Removing the claim that the CLI doesn't support repository API tokens left the documentation silent about it. Document it instead, now that OD-489 shipped in codacy-cloud-cli v1.9.0: - The option --repository-token and the CODACY_PROJECT_TOKEN environment variable, and that codacy login only takes account API tokens. - The precedence between the two tokens, the option, and stored credentials. - That commands outside the operations a repository API token authorizes fail immediately, and that codacy repository omits pull request and coverage data. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Per .claude/reference/formatting.md, checked against the docs-review-page rubric: - api-tokens.md: the two "replace grandfathered tokens" notes packed a 3-step sequence the reader must follow in order into one comma-chained sentence. Converted to a nested numbered list in both places, without adding an admonition, so the admonition count from the last round stays the same. - codacy-cloud-cli/index.md: split ## Authentication into ### Account API tokens and ### Repository API tokens, matching the ### subsection pattern already used by every other multi-topic section on this page (## What you can do, ## Example workflows). Moved "To remove your stored credentials" under Account API tokens, since codacy logout only applies to stored login credentials, not to a repository token passed via flag or env var. Verified with mkdocs build --strict: no broken anchors, no duplicate heading ids on the page. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Changes
docs/codacy-api/api-tokens.md: document repository API token name rules, mandatory 1-year-max expiry (no never-expire option), that the token value stays fully visible after creation (not masked), grandfathered legacy tokens without an expiry, the distinct "token expired" error, and the full list of 13 operations a repository token can authorize (own repository only).docs/codacy-api/using-the-codacy-api.md: correct the auth section's outdated claim that all API v3 endpoints require an account token, and add a note on repository-token expiry/error behavior.👀 Live preview
https://doc-repo-tokens-product-page-od-395--docs-codacy.netlify.app
🚧 To do
Manual Testing
Add manual testing evidence here (steps, screenshots, environment).