Expand description
§Cider API
Async Rust client for the Cider music player REST API.
Cider exposes a local HTTP API (default port 10767) for controlling
playback, managing the queue, and querying track information. This crate
provides a fully typed, async client built on reqwest.
§Quick start
use cider_api::CiderClient;
let client = CiderClient::new();
// Check if Cider is running
client.is_active().await?;
// Get the currently playing track
if let Some(track) = client.now_playing().await? {
println!("{} — {}", track.name, track.artist_name);
println!("Album: {}", track.album_name);
println!("Artwork: {}", track.artwork_url(600));
println!(
"Position: {:.1}s / {:.1}s",
track.current_playback_time,
track.duration_in_millis as f64 / 1000.0,
);
}
// Control playback
client.pause().await?;
client.seek_ms(30_000).await?;
client.play().await?;§Authentication
If Cider has API authentication enabled (Settings > Connectivity > Manage
External Application Access), pass the token via CiderClient::with_token:
let client = CiderClient::new().with_token("your-api-token");The token is sent in the apitoken header — no Bearer prefix.
§API coverage
| Category | Methods |
|---|---|
| Status | is_active, is_playing, now_playing |
| Playback | play, pause, play_pause, stop, next, previous, seek, seek_ms |
| Play items | play_url, play_item, play_item_href, play_next, play_later |
| Queue | get_queue, queue_move_to_position, queue_remove_by_index, clear_queue |
| Volume | get_volume, set_volume |
| Settings | get_repeat_mode, toggle_repeat, get_shuffle_mode, toggle_shuffle, get_autoplay, toggle_autoplay |
| Library | add_to_library, set_rating |
| Apple Music API | amapi_run_v3 |
Structs§
- AmApi
Request - Request body for
POST /api/v1/amapi/run-v3. - ApiResponse
- Generic wrapper for Cider API JSON responses.
- Artwork
- Artwork metadata for a track, album, or station.
- Autoplay
Response - Payload for
GET /autoplay. - Cider
Client - Async client for the Cider music player REST API.
- IsPlaying
Response - Payload for
GET /is-playing. - KeyUrls
- DRM / streaming key URLs for HLS playback.
- NowPlaying
- Currently playing track information returned by
GET /now-playing. - NowPlaying
Response - Payload for
GET /now-playing. - Play
Item Href Request - Request body for
POST /play-item-href. - Play
Item Request - Request body for
POST /play-item/POST /play-next/POST /play-later. - Play
Params - Play parameters identifying a playable item.
- Play
UrlRequest - Request body for
POST /play-url. - Preview
- A track audio preview.
- Queue
Container - The container (playlist, station, album) a queue item was sourced from.
- Queue
Context - Context metadata for a
QueueItem. - Queue
Item - A single item in the Cider playback queue.
- Queue
Item Attributes - Track attributes within a
QueueItem. - Queue
Item State - Playback state of a
QueueItem. - Queue
Move Request - Request body for
POST /queue/move-to-position. - Queue
Remove Request - Request body for
POST /queue/remove-by-index. - Rating
Request - Request body for
POST /set-rating. - Repeat
Mode Response - Payload for
GET /repeat-mode. - Seek
Request - Request body for
POST /seek. - Shuffle
Mode Response - Payload for
GET /shuffle-mode. - Volume
Request - Request body for
POST /volume. - Volume
Response - Payload for
GET /volume.
Enums§
- Cider
Error - Errors returned by
CiderClientmethods.
Constants§
- DEFAULT_
PORT - Default Cider RPC port.