Skip to content

[Feature] Add raw request method to Python SDK for calling arbitrary API endpoints #243

Description

@dyeam0

Checklist

Describe the problem you'd like to have solved

Currently, the SDK provides typed methods for specific API endpoints (check, write, read, etc.). However, there is no way to call arbitrary OpenFGA API endpoints that may not yet have dedicated SDK methods. This creates a gap when:

  • New OpenFGA API endpoints are released but SDK updates have not been implemented yet
  • Experimental endpoints need to be tested
  • Developers need a temporary alternative while waiting for official SDK support

Without a raw request method, developers are forced to either wait for SDK updates, or fork and modify the SDK code themselves, or call the OpenFGA API directly without the SDK, losing the benefits of SDK authentication, configuration, and error handling patterns. This reduces developer agility and creates friction in adopting new OpenFGA features.

Describe the ideal solution

Add a raw request method to the SDKs that allows developers to make arbitrary HTTP requests to any OpenFGA API endpoint while still leveraging the SDK's authentication, configuration, and error handling patterns.

This would provide an escape hatch for developers while maintaining consistency with the SDK's configuration. The typed methods would remain the recommended approach for standard API calls, while the raw request method provides flexibility during early adoption of new features.

Alternatives and current workarounds

  • Fork and modify the SDK code
  • Call the OpenFGA API directly without the SDK

Neither workaround is ideal.

References

Additional context

No response

Activity

  1. coderabbitai commented on Nov 4, 2025

    @coderabbitai
    Contributor

    A summary of the changes CodeRabbit can apply:

    • Add an SDK "raw_request" escape-hatch by implementing async and sync OpenFgaClient.raw_request methods (modified openfga_sdk/client/client.py and openfga_sdk/sync/client/client.py), plus accompanying tests (test/client/raw_request_test.py, test/sync/client/raw_request_test.py), documentation (docs/RawRequest.md, RAW_REQUEST_QUICK_REFERENCE.md, IMPLEMENTATION_SUMMARY.md, FEATURE_CHANGELOG.md), and runnable examples (example/raw-request/example.py, example/raw-request/README.md).

    • Add a new raw_request escape-hatch to both async and sync OpenFgaClient (implemented in openfga_sdk/client/client.py and openfga_sdk/sync/client/client.py), and include comprehensive support and delivery changes: add async and sync test suites (test/client/raw_request_test.py, test/sync/client/raw_request_test.py), full documentation and quick reference (docs/RawRequest.md, RAW_REQUEST_QUICK_REFERENCE.md), examples and README (example/raw-request/example.py, example/raw-request/README.md), and project metadata/changelog and implementation notes (FEATURE_CHANGELOG.md, IMPLEMENTATION_SUMMARY.md) so callers can invoke arbitrary OpenFGA endpoints while preserving SDK auth, retries, telemetry, and error handling.

    • ✅ Create PR with these edits
    • 📋 Get copyable edits
  2. moved this from Intake to Backlog in SDKs and Toolingon Nov 4, 2025
  3. kcbiradar commented on Nov 22, 2025

    @kcbiradar
    Contributor

    @dyeam0 Hi! I’d like to work on this issue. Could you please confirm if it’s still open and if there are any specific guidelines or expectations before I get started?

  4. moved this from Backlog to On deck in SDKs and Toolingon Jan 14, 2026
  5. Abishek-Newar commented on Jan 14, 2026

    @Abishek-Newar
    Contributor

    Hi @dyeam0 , Since I have alreay worked on the same thing for js-sdk, can i procees to do this for python-sdk as well

  6. dyeam0 commented on Jan 14, 2026

    @dyeam0
    MemberAuthor

    Hi @kcbiradar and @Abishek-Newar, thanks for the offers to contribute!

    @Abishek-Newar Let's see if @kcbiradar is still interested since he asked back in November. @kcbiradar Sorry we did not respond earlier. We had a few higher-priority items we were focused on during December. This issue is bumped back up in priority. Are you still ready to take this feature?

    The guidelines are that we have a requirement to maintain consistency across all languages SDKs, as much as possible, with the exception of language-specific idiomatic code. Would you be able to review the existing Go implementation (PR openfga/go-sdk#258) or Abhishek's JS PR (openfga/js-sdk#298) under review, and look to maintain consistency with those SDKs.

  7. dyeam0 commented on Jan 14, 2026

    @dyeam0
    MemberAuthor

    Hi @dyeam0 , Since I have alreay worked on the same thing for js-sdk, can i procees to do this for python-sdk as well

    @Abishek-Newar Also there are still .NET and Java available, if you know those languages too. :)

  8. kcbiradar commented on Jan 14, 2026

    @kcbiradar
    Contributor

    @dyeam0 No problem, I'm happy to contribute.

  9. dyeam0 commented on Jan 15, 2026

    @dyeam0
    MemberAuthor

    Thanks @kcbiradar! I have assigned the GH issue to you.

  10. moved this from On deck to In progress in SDKs and Toolingon Jan 15, 2026
  11. moved this from In progress to In review in SDKs and Toolingon Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions