---
title: "Create Huggingface Oauth State"
method: POST
path: "/huggingface/oauth-state"
tags: ["huggingface"]
---

# Create Huggingface Oauth State

`POST /huggingface/oauth-state`

Create a HuggingFace OAuth state token via the backend.

Args:
    request: Redirect URL payload.
    auth: Authenticated user context.
    service: HuggingFace service.

Returns:
    Generated state token for the frontend OAuth redirect.

## Request body

- HuggingFaceOAuthStateRequest — Request body for creating a HuggingFace OAuth state token.
  - `redirect_url` string, nullable — Optional post-connect redirect URL.

## Response `200`

Successful Response

- HuggingFaceOAuthStateResponse — Response containing the generated HuggingFace OAuth state token.
  - `state_token` string, required — Generated state token.

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/pioneer/apis/brain-api.md) · [All operations](https://skmtc.net/pioneer/apis/brain-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/pioneer/brain-api/revisions/b92f75fd3b61/schema)
