Skip to main content
Async Python client for Stash GraphQL API Python 3.12+ License: AGPL-3.0

Overview

stash-graphql-client is a modern, type-safe Python library for interacting with Stash media server’s GraphQL API. Built with async-first architecture and comprehensive Pydantic type definitions, it provides a robust foundation for automating and extending your Stash instance.

Key Features

  • πŸš€ Async-first: Built on gql with HTTPXAsyncTransport and WebsocketsTransport
  • πŸ“ Fully Typed: All Stash GraphQL schema objects as Pydantic v2 models
  • πŸ”„ Complete CRUD: Operations for scenes, galleries, performers, studios, tags, and more
  • βš™οΈ Job Management: Metadata scanning, generation, and real-time job status tracking
  • πŸ“‘ Subscriptions: GraphQL subscription support for live updates
  • 🎯 Identity Map: Built-in caching for efficient object reuse and relationship navigation
  • πŸ“… Fuzzy Dates: First-class support for Stash v0.30.0+ partial date formats

Quick Example

What Makes This Different?

Identity Map Pattern

Same entity IDs return the same object reference across all queries, ensuring data consistency:

UNSET Sentinel

Distinguish between unqueried fields, null values, and actual data:

Fuzzy Date Support

Work with partial dates just like Stash v0.30.0+:

Who Should Use This?

This library is perfect for:
  • Automation: Build scripts to organize and manage your Stash library
  • Integration: Connect Stash with other tools and services
  • Extensions: Create custom workflows and plugins
  • Analysis: Extract and analyze metadata from your collection
  • Testing: Programmatically interact with Stash for testing purposes

Next Steps

UNSET Pattern

Learn core concepts and patterns

API Docs

Comprehensive API documentation

Date Utilities

Work with partial dates

License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0-or-later). See LICENSE for the full license text. This license ensures:
  • βœ… Open source code sharing
  • βœ… Network use requires source disclosure
  • βœ… Compatible with Stash (also AGPL-3.0)
  • βœ… Derivative works must also be AGPL-3.0