API endpoints for gated dataset access requests
NONE
Looks like a [similar feature request](https://github.com/huggingface/huggingface_hub/issues/1198) was made to the HF Hub team. Is handling this at the Hub level more appropriate?

(As an aside, I've gotten the [HTTP-based solution](https://github.com/huggingface/huggingface_hub/issues/1198#issuecomment-1905774983) proposed in that forum to work for simple cases.)
2025-01-09T10:52:38Z
https://github.com/huggingface/datasets/issues/7364#issuecomment-2579826178
https://api.github.com/repos/huggingface/datasets/issues/7364
IC_kwDODunzps6ZxQYC
https://api.github.com/repos/huggingface/datasets/issues/comments/2579826178/reactions
2025-01-09T10:52:38Z
https://api.github.com/repos/huggingface/datasets/issues/comments/2579826178
https://avatars.githubusercontent.com/u/6140840?v=4
https://api.github.com/users/jerome-white/events{/privacy}
https://api.github.com/users/jerome-white/followers
https://api.github.com/users/jerome-white/following{/other_user}
https://api.github.com/users/jerome-white/gists{/gist_id}
https://github.com/jerome-white
jerome-white
MDQ6VXNlcjYxNDA4NDA=
https://api.github.com/users/jerome-white/orgs
https://api.github.com/users/jerome-white/received_events
https://api.github.com/users/jerome-white/repos
https://api.github.com/users/jerome-white/starred{/owner}{/repo}
https://api.github.com/users/jerome-white/subscriptions
User
https://api.github.com/users/jerome-white
public
MEMBER
yes it's more for https://github.com/huggingface/huggingface_hub cc @hanouticelina 
2025-01-09T10:59:09Z
https://github.com/huggingface/datasets/issues/7364#issuecomment-2579841741
https://api.github.com/repos/huggingface/datasets/issues/7364
IC_kwDODunzps6ZxULN
https://api.github.com/repos/huggingface/datasets/issues/comments/2579841741/reactions
2025-01-09T11:08:36Z
https://api.github.com/repos/huggingface/datasets/issues/comments/2579841741
https://avatars.githubusercontent.com/u/326577?v=4
https://api.github.com/users/julien-c/events{/privacy}
https://api.github.com/users/julien-c/followers
https://api.github.com/users/julien-c/following{/other_user}
https://api.github.com/users/julien-c/gists{/gist_id}
https://github.com/julien-c
julien-c
MDQ6VXNlcjMyNjU3Nw==
https://api.github.com/users/julien-c/orgs
https://api.github.com/users/julien-c/received_events
https://api.github.com/users/julien-c/repos
https://api.github.com/users/julien-c/starred{/owner}{/repo}
https://api.github.com/users/julien-c/subscriptions
User
https://api.github.com/users/julien-c
public
MEMBER
yes i think @Wauplin's comment on that thread is still what we recommend
2025-01-09T11:13:08Z
https://github.com/huggingface/datasets/issues/7364#issuecomment-2579874179
https://api.github.com/repos/huggingface/datasets/issues/7364
IC_kwDODunzps6ZxcGD
https://api.github.com/repos/huggingface/datasets/issues/comments/2579874179/reactions
2025-01-09T11:13:08Z
https://api.github.com/repos/huggingface/datasets/issues/comments/2579874179
https://avatars.githubusercontent.com/u/326577?v=4
https://api.github.com/users/julien-c/events{/privacy}
https://api.github.com/users/julien-c/followers
https://api.github.com/users/julien-c/following{/other_user}
https://api.github.com/users/julien-c/gists{/gist_id}
https://github.com/julien-c
julien-c
MDQ6VXNlcjMyNjU3Nw==
https://api.github.com/users/julien-c/orgs
https://api.github.com/users/julien-c/received_events
https://api.github.com/users/julien-c/repos
https://api.github.com/users/julien-c/starred{/owner}{/repo}
https://api.github.com/users/julien-c/subscriptions
User
https://api.github.com/users/julien-c
public
### Feature request

I would like a programatic way of requesting access to gated datasets. The current solution to gain access forces me to visit a website and physically click an "agreement" button (as per the [documentation](https://huggingface.co/docs/hub/en/datasets-gated#access-gated-datasets-as-a-user)).

An ideal approach would be HF API download methods that negotiate access on my behalf based on information from my CLI login and/or token. I realise that may be naive given the various types of access semantics available to dataset authors (automatic versus manual approval, for example) and complexities it might add to existing methods, but something along those lines would be nice.

Perhaps using the `*_access_request` methods available to dataset authors can be a precedent; see [`reject_access_request`](https://huggingface.co/docs/huggingface_hub/main/en/package_reference/hf_api#huggingface_hub.HfApi.reject_access_request) for example.

### Motivation

When trying to download files from a gated dataset, I'm met with a `GatedRepoError` and instructed to visit the repository's website to gain access:

```
Cannot access gated repo for url https://huggingface.co/datasets/open-llm-leaderboard/meta-llama__Meta-Llama-3.1-70B-Instruct-details/resolve/main/meta-llama__Meta-Llama-3.1-70B-Instruct/samples_leaderboard_math_precalculus_hard_2024-07-19T18-47-29.522341.jsonl.
Access to dataset open-llm-leaderboard/meta-llama__Meta-Llama-3.1-70B-Instruct-details is restricted and you are not in the authorized list. Visit https://huggingface.co/datasets/open-llm-leaderboard/meta-llama__Meta-Llama-3.1-70B-Instruct-details to ask for access.
```

This makes task automation extremely difficult. For example, I'm interested in studying sample-level responses of models on the LLM leaderboard -- how they answered particular questions on a given evaluation framework. As I come across more and more participants that gate their data, it's becoming unwieldy to continue my work (there over 2,000 participants, so in the worst case that's the number of website visits I'd need to manually undertake).

One approach is use Selenium to react to the `GatedRepoError`, but that seems like overkill; and a potential violation HF terms of service (?).

As mentioned in the previous section, there seems to be an [API for gated dataset owners](https://huggingface.co/docs/hub/en/datasets-gated#via-the-api) to managed access requests, and thus some appetite for allowing automated management of gating. This feature request is to extend that to dataset users.

### Your contribution

Whether I can help depends on a few things; one being the complexity of the underlying gated access design. If this feature request is accepted I am open to being involved in discussions and testing, and even development under the right time-outcome tradeoff.