# Open States GraphQL API Schema (v2 - Deprecated) # Derived from source: https://github.com/openstates/openstates.org/tree/main/graphapi # Endpoint: https://openstates.org/graphql/ # Authentication: API key required (obtain at https://open.pluralpolicy.com/) # Note: This v2 GraphQL API is deprecated; migrate to REST API v3 at https://v3.openstates.org/ schema { query: Query } # ------------------------------------------------------------------- # Root Query # ------------------------------------------------------------------- type Query { # Jurisdiction queries jurisdictions( classification: String before: String after: String first: Int last: Int ): JurisdictionConnection jurisdiction(id: String, name: String): Jurisdiction # People queries people( memberOf: String everMemberOf: String district: String divisionId: String name: String updatedSince: String latitude: Float longitude: Float before: String after: String first: Int last: Int ): PersonConnection person(id: ID): Person # Organization / Committee query organization(id: ID): Organization # Bill queries bill( id: String jurisdiction: String session: String identifier: String openstatesUrl: String ): Bill bills( jurisdiction: String session: String chamber: String updatedSince: String subject: String sponsor: SponsorInput classification: String actionSince: String searchQuery: String before: String after: String first: Int last: Int ): BillConnection # Event queries events( jurisdiction: String before: String after: String first: Int last: Int ): EventConnection event(id: ID): Event } # ------------------------------------------------------------------- # Input Types # ------------------------------------------------------------------- input SponsorInput { name: String primary: Boolean person: String } # ------------------------------------------------------------------- # Base / Shared Types # ------------------------------------------------------------------- # Base interface for Open Civic Data entities interface OCDBase { id: String createdAt: String updatedAt: String extras: String } type Identifier { identifier: String scheme: String } type Link { note: String url: String } type Name { name: String note: String startDate: String endDate: String } # ------------------------------------------------------------------- # Pagination: Relay-style PageInfo # ------------------------------------------------------------------- type PageInfo { hasNextPage: Boolean! hasPreviousPage: Boolean! startCursor: String endCursor: String } # ------------------------------------------------------------------- # Jurisdiction & Legislative Session Types # ------------------------------------------------------------------- type Jurisdiction { id: String name: String url: String classification: String featureFlags: [String] lastScrapedAt: String legislativeSessions( before: String after: String first: Int last: Int ): LegislativeSessionConnection organizations( classification: [String] before: String after: String first: Int last: Int ): OrganizationConnection } type JurisdictionConnection { pageInfo: PageInfo! edges: [JurisdictionEdge] } type JurisdictionEdge { node: Jurisdiction cursor: String! } # Represents a legislative session within a jurisdiction type Session { jurisdiction: Jurisdiction identifier: String name: String classification: String startDate: String endDate: String } # Alias for backward-compat (same as Session) type LegislativeSession { jurisdiction: Jurisdiction identifier: String name: String classification: String startDate: String endDate: String } type LegislativeSessionConnection { pageInfo: PageInfo! edges: [LegislativeSessionEdge] } type LegislativeSessionEdge { node: LegislativeSession cursor: String! } # Metadata about a scraped session run type SessionScraped { session: Session scrapedAt: String success: Boolean recordsUpdated: Int errors: [String] } # ------------------------------------------------------------------- # Division & Post # ------------------------------------------------------------------- type Division { id: String createdAt: String updatedAt: String extras: String name: String redirect: Division country: String } type Post { id: String createdAt: String updatedAt: String extras: String label: String role: String division: Division startDate: String endDate: String maximumMemberships: Int } # ------------------------------------------------------------------- # Person & Related Sub-Types # ------------------------------------------------------------------- # A single image URL associated with a legislator type PersonImage { url: String note: String } # An alternate or historical name for a person type PersonName { name: String note: String startDate: String endDate: String } # An external link associated with a person (official page, etc.) type PersonLink { url: String note: String } # A data source citation for a person record type PersonSource { url: String note: String } # Contact information entry for a legislator type PersonContact { type: String value: String note: String label: String } type Office { classification: String address: String voice: String fax: String displayName: String } # Deprecated alias kept for backwards compatibility type ContactDetail { type: String value: String note: String label: String } type Person { id: String createdAt: String updatedAt: String extras: String name: String sortName: String familyName: String givenName: String image: String birthDate: String deathDate: String primaryParty: String email: String images: [PersonImage] identifiers: [Identifier] otherNames: [PersonName] links: [PersonLink] sources: [PersonSource] contactDetails: [PersonContact] offices: [Office] currentMemberships(classification: [String]): [Membership] oldMemberships(classification: [String]): [Membership] votes( before: String after: String first: Int last: Int ): BillVoteConnection } type PersonConnection { pageInfo: PageInfo! edges: [PersonEdge] totalCount: Int } type PersonEdge { node: Person cursor: String! } # ------------------------------------------------------------------- # Organization, Committee & Membership # ------------------------------------------------------------------- type Organization { id: String createdAt: String updatedAt: String extras: String name: String image: String classification: String foundingDate: String dissolutionDate: String jurisdictionId: String parent: Organization children( classification: String before: String after: String first: Int last: Int ): OrganizationConnection currentMemberships: [Membership] identifiers: [Identifier] otherNames: [Name] links: [Link] sources: [Link] } type OrganizationConnection { pageInfo: PageInfo! edges: [OrganizationEdge] totalCount: Int } type OrganizationEdge { node: Organization cursor: String! } type Membership { id: String createdAt: String updatedAt: String extras: String organization: Organization person: Person personName: String post: Post label: String role: String startDate: String endDate: String } # A legislative committee (specialisation of Organization) type Committee { id: String createdAt: String updatedAt: String name: String classification: String chamber: String jurisdiction: Jurisdiction parent: Committee members: [CommitteeMember] sources: [Link] } # A member of a committee with their role type CommitteeMember { person: Person role: String startDate: String endDate: String } # ------------------------------------------------------------------- # Bill & Related Sub-Types # ------------------------------------------------------------------- type BillAbstract { abstract: String note: String date: String } type BillTitle { title: String note: String } type BillIdentifier { identifier: String scheme: String note: String } # Entity (person or organization) related to a bill action type BillActionRelatedEntity { name: String entityType: String organization: Organization person: Person } # Deprecated alias for BillActionRelatedEntity type RelatedEntity { name: String entityType: String organization: Organization person: Person } type BillAction { organization: Organization description: String date: String classification: [String] order: Int extras: String vote: VoteEvent relatedEntities: [BillActionRelatedEntity] } # A link to a bill document file with MIME type info type BillDocumentLink { mediaType: String url: String text: String } # Deprecated alias for BillDocumentLink type MimetypeLink { mediaType: String url: String text: String } # A supporting document (amendment, fiscal note, etc.) attached to a bill type BillDocument { note: String date: String links: [BillDocumentLink] } # A link to a bill version file with MIME type info type BillVersionLink { mediaType: String url: String text: String } # A version/text of the bill (introduced, amended, enrolled, etc.) type BillVersion { note: String date: String links: [BillVersionLink] } # A source URL citation for a bill record type BillSource { url: String note: String } type BillSponsorship { name: String entityType: String organization: Organization person: Person primary: Boolean classification: String } # A cross-reference to a related bill (companion, amendment, etc.) type BillRelatedBill { identifier: String legislativeSession: String relationType: String relatedBill: Bill } # Deprecated alias for BillRelatedBill type RelatedBill { identifier: String legislativeSession: String relationType: String relatedBill: Bill } # A voter's cast vote on a VoteEvent type BillVoteVoter { option: String voterName: String voter: Person note: String } # Deprecated alias for BillVoteVoter type PersonVote { option: String voterName: String voter: Person note: String } # A summary count of votes by option (yes/no/abstain/etc.) type BillVoteCount { option: String value: Int } # Deprecated alias for BillVoteCount type VoteCount { option: String value: Int } # A person's vote record as seen from the bill perspective type BillVote { option: String note: String voteEvent: VoteEvent } type Bill { id: String createdAt: String updatedAt: String extras: String legislativeSession: LegislativeSession identifier: String title: String fromOrganization: Organization classification: [String] subject: [String] abstracts: [BillAbstract] otherTitles: [BillTitle] otherIdentifiers: [BillIdentifier] actions: [BillAction] sponsorships: [BillSponsorship] relatedBills: [BillRelatedBill] documents: [BillDocument] versions: [BillVersion] sources: [BillSource] votes( before: String after: String first: Int last: Int ): VoteConnection openstatesUrl: String } type BillConnection { pageInfo: PageInfo! edges: [BillEdge] totalCount: Int } type BillEdge { node: Bill cursor: String! } # ------------------------------------------------------------------- # Vote / VoteEvent Types # ------------------------------------------------------------------- type VoteEvent { id: String createdAt: String updatedAt: String extras: String identifier: String motionText: String motionClassification: [String] startDate: String endDate: String result: String organization: Organization billAction: BillAction legislativeSession: LegislativeSession bill: Bill votes: [BillVoteVoter] counts: [BillVoteCount] sources: [Link] } type VoteConnection { pageInfo: PageInfo! edges: [VoteEdge] } type VoteEdge { node: VoteEvent cursor: String! } type BillVoteConnection { pageInfo: PageInfo! edges: [BillVoteEdge] } type BillVoteEdge { node: BillVote cursor: String! } # ------------------------------------------------------------------- # Event Types # ------------------------------------------------------------------- # An entity related to an event agenda item (bill, person, organization) type EventRelatedEntity { entityType: String name: String bill: Bill person: Person organization: Organization note: String } # A single item on a legislative event agenda type EventAgendaItem { description: String order: Int subjects: [String] notes: [String] relatedEntities: [EventRelatedEntity] } # A legislative event such as a committee hearing or floor session type Event { id: String createdAt: String updatedAt: String extras: String name: String description: String classification: String startDate: String endDate: String timezone: String allDay: Boolean status: String location: String jurisdiction: Jurisdiction agenda: [EventAgendaItem] sources: [Link] } type EventConnection { pageInfo: PageInfo! edges: [EventEdge] totalCount: Int } type EventEdge { node: Event cursor: String! }