Skip to content

feat(organization): expose PATCH /v2/organization/{organization_id} in the OpenAPI schema - #39794

Merged
ryan-crabbe-berri merged 2 commits into
litellm_internal_stagingfrom
litellm_v2_org_update_public
Sep 4, 2026
Merged

ryan-crabbe-berri merged 2 commits into
litellm_internal_stagingfrom
litellm_v2_org_update_public

Conversation

@ryan-crabbe-berri

@ryan-crabbe-berri ryan-crabbe-berri commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

How it solves it:

  • Drops include_in_schema=False from the v2 route
  • The endpoint now shows in /docs, openapi.json, and generated clients
  • A test pins the route as public so it can't silently vanish again

User Flow

Before: a developer scripting org management can't find a PATCH endpoint with merge-patch semantics

  1. They open https://litellm-domain/docs and search for organization endpoints
  2. Only POST /organization/new, PATCH /organization/update and friends appear; no /v2/organization/{organization_id}
  3. GET https://litellm-domain/openapi.json confirms the v2 path is absent, so their generated client has no method for it

After: the v2 endpoint is documented and discoverable

  1. They open https://litellm-domain/docs and find PATCH /v2/organization/{organization_id} under organization management, with typed request and response schemas
  2. GET https://litellm-domain/openapi.json lists the path, so generated clients pick it up
  3. They send PATCH https://litellm-domain/v2/organization/{organization_id} with {"organization_alias": "renamed"} and get HTTP 200 with the updated org

Relevant issues

Linear ticket

Resolves LIT-5769

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

Shared setup: proxy running litellm/proxy/dev_config.yaml on localhost:4187 against local Postgres, master key sk-1234

Before (62087c5)

  1. curl -s http://localhost:4187/openapi.json | jq '.paths | has("/v2/organization/{organization_id}")' prints false

After (3e4a884, tip 0eb2363 only reroutes the test through the production OpenAPI generator)

  1. curl -s http://localhost:4187/openapi.json | jq '.paths | has("/v2/organization/{organization_id}")' prints true
  2. curl -s http://localhost:4187/openapi.json | jq -c '.paths["/v2/organization/{organization_id}"] | {ops: keys, summary: .patch.summary, tags: .patch.tags}' prints {"ops":["patch"],"summary":"Update Organization V2","tags":["organization management"]}
  3. The endpoint still works: curl -s -w '\nHTTP %{http_code}\n' -X PATCH "http://localhost:4187/v2/organization/$ORG_ID" -H 'Authorization: Bearer sk-1234' -H 'Content-Type: application/json' -d '{"organization_alias":"v2-public-qa-renamed"}' | tail -1 prints HTTP 200, and GET /organization/info shows the new alias

Type

🆕 New Feature

Caveats (if any)

Medium

Low

  • ui/litellm-dashboard schema.d.ts is unchanged: the UI type generator already includes hidden routes

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

@greptile-apps

greptile-apps Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR exposes the existing authenticated PATCH /v2/organization/{organization_id} endpoint through the production OpenAPI schema.

  • Removes include_in_schema=False from the existing route.
  • Adds a regression test using the production OpenAPI generator.
  • The earlier concern that the test bypassed production schema generation is fixed.
  • The prior docstring concern was withdrawn, and both previous threads are resolved.

Confidence Score: 5/5

The PR appears safe to merge, with no outstanding correctness, security, or repository-rule issues.

The production change only exposes an already registered and authenticated route in OpenAPI, and the regression test now validates that behavior through the production schema generator. Both previous findings are resolved or withdrawn.

Important Files Changed

Filename Overview
litellm/proxy/management_endpoints/organization_endpoints.py Makes the existing authenticated organization update route discoverable in OpenAPI without changing runtime behavior.
tests/test_litellm/proxy/management_endpoints/test_organization_endpoints.py Verifies through the production schema generator that the v2 organization PATCH operation remains public.

Reviews (3): Last reviewed commit: "test(organization): assert route publici..." | Re-trigger Greptile

Comment thread tests/test_litellm/proxy/management_endpoints/test_organization_endpoints.py Outdated
@codspeed

codspeed Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_v2_org_update_public (0eb2363) with litellm_internal_staging (205a5e9)1

Open in CodSpeed

Footnotes

  1. No successful run was found on litellm_internal_staging (d71fe43) during the generation of this report, so 205a5e9 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ryan-crabbe-berri

Copy link
Copy Markdown
Contributor Author

@greptile re review

1 similar comment
@ryan-crabbe-berri

Copy link
Copy Markdown
Contributor Author

@greptile re review

@ryan-crabbe-berri
ryan-crabbe-berri merged commit 189bd85 into litellm_internal_staging Sep 4, 2026
185 of 186 checks passed
@ryan-crabbe-berri
ryan-crabbe-berri deleted the litellm_v2_org_update_public branch September 4, 2026 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants