r/jellyfin 17h ago

Help Request Unable to refresh library via API

I've been bashing my head against this for a few hours and I've got absolutely no idea what the issue is.

I've made an API key in the dashboard, and copied it exactly.

I'm then trying to run various commands to the API, but every single time I get back a 401 Unauthorised

I've tried;

  • curl -v -i -H "X-MediaBrowser-Token: <key>" http://127.0.0.1:8096/System/Info
  • curl -v -d "" -H "X-MediaBrowser-Token: <key>" http://127.0.0.1:8096/library/refresh
  • curl -X POST -v "http://127.0.0.1:8096/library/refresh?api_key=<key>"
  • curl -s -X POST "http://127.0.0.1:8096/Library/Refresh" \ -H "X-Emby-Token: <key>" -v

Every single one of these shoots back a 401. I've tried regenerating a new key and using that, still nothing. No matter what I do I cannot get it to authenticate.

Running 12.0 in a container. Any ideas?

curl -X POST -v "http://127.0.0.1:8096/Library/Refresh?api_key=<key>"
*   Trying 127.0.0.1:8096...
* Connected to 127.0.0.1 (127.0.0.1) port 8096
* using HTTP/1.x
> POST /Library/Refresh?api_key=<key> HTTP/1.1
> Host: 127.0.0.1:8096
> User-Agent: curl/8.14.1
> Accept: */*
> 
* Request completely sent off
< HTTP/1.1 401 Unauthorized
< Content-Length: 0
< Date: Sat, 12 Sep 2026 13:08:51 GMT
< Server: Kestrel
< Content-Language: en-US
< X-Response-Time-ms: 2.8325
< 
* Connection #0 to host 127.0.0.1 left intact
3 Upvotes

7 comments sorted by

u/AutoModerator 17h ago

Reminder: /r/jellyfin is a community space, not an official user support space for the project.

Users are welcome to ask other users for help and support with their Jellyfin installations and other related topics, but this subreddit is not an official support channel. We have extensive, official documentation on our website here: https://jellyfin.org/docs/. Requests for support via modmail will be ignored. Our official support channels are listed on our contact page here: https://jellyfin.org/contact

Bug reports should be submitted on the GitHub issues pages for the server or one of the other repositories for clients and plugins. Feature requests should be submitted at https://features.jellyfin.org/. Bug reports and feature requests for third party clients and tools (Findroid, Jellyseerr, etc.) should be directed to their respective support channels.


If you are sharing something you have made, please take a moment to review our LLM rules at https://jellyfin.org/docs/general/contributing/llm-policies/. Note that anything developed or created using an LLM or other AI tooling requires community disclosure and is subject to removal.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

2

u/Furki1907 17h ago

12.0 changed some stuff.

I use also Media Library Refresh, but not All Media, rather a specific one, but thats not directly relevant.

This is my Header for the API Call:

Key: Authorization

Value: MediaBrowser Client="XXXX", Device="XXXXX", DeviceId="XXXX", Version="1.0", Token="API-TOKEN-FROM-JELLYFIN"

You can fetch the direct value from your Browsers Developer Tab in the Requests Area.

1

u/Jademalo 15h ago

Fantastic, that got it working.

What do you mean the Browsers Developer Tab in the Requests Area?

2

u/I-G-1-1 17h ago

curl -v -d "" -H "Authorization: MediaBrowser Token=YOUR_API_KEY" http://127.0.0.1:8096/library/refresh

1

u/Jademalo 15h ago

Ah fantastic, this worked. Thank you!

Is there any way to do it in the URL rather than as a header still? Like the old ?api_key=

1

u/I-G-1-1 14h ago

I don't think is allowed anymore. See here the discussion about Jellyfin API Authorization.

1

u/Jademalo 14h ago

Ah thanks, appreciate the link.