Skip to content

Examples

Get basic information for all legislatures

See in GraphiQL

{
  jurisdictions {
    edges {
      node {
        name
        legislativeSessions {
          edges {
            node {
              name
            }
          }
        }
        legislature: organizations(classification: "legislature", first: 1) {
          edges {
            node {
              name
              classification
              children(first: 5) {
                edges {
                  node {
                    name
                    classification
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

Get overview of a legislature\'s structure

See in GraphiQL

{
  jurisdiction(name: "North Dakota") {
    name
    url
    legislativeSessions {
      edges {
        node {
          name
          identifier
        }
      }
    }
    organizations(classification: "legislature", first: 1) {
      edges {
        node {
          id
          name
          children(first: 20) {
            edges {
              node {
                name
              }
            }
          }
        }
      }
    }
  }
}

Search for bills that match a given condition

See in GraphiQL

{
  search_1: bills(first: 5, jurisdiction: "New York", session: "2017-2018", chamber: "lower", classification: "resolution", updatedSince: "2017-01-15") {
    edges {
      node {
        id
        identifier
        title
        classification
        updatedAt
        createdAt
        legislativeSession {
          identifier
          jurisdiction {
            name
          }
        }
        actions {
          date
          description
          classification
        }
        documents {
          date
          note
          links {
            url
          }
        }
        versions {
          date
          note
          links {
            url
          }
        }

        sources {
          url
          note

        }
      }
    }
  }
}

Get all information on a particular bill

See in GraphiQL

{
  b1: bill(jurisdiction: "Hawaii", session: "2017 Regular Session", identifier: "HB 475") {
    id
    identifier
    title
    classification
    updatedAt
    createdAt
    legislativeSession {
      identifier
      jurisdiction {
        name
      }
    }
    actions {
      date
      description
      classification
    }
    documents {
      date
      note
      links {
        url
      }
    }
    versions {
      date
      note
      links {
        url
      }
    }
    sources {
      url
      note
    }
  }
  b2: bill(id: "ocd-bill/9c24aaa2-6acc-43ad-883b-ae9f677062e9") {
    id
    identifier
    title
    classification
    updatedAt
    createdAt
    legislativeSession {
      identifier
      jurisdiction {
        name
      }
    }
    actions {
      date
      description
      classification
    }
    documents {
      date
      note
      links {
        url
      }
    }
    versions {
      date
      note
      links {
        url
      }
    }
    sources {
      url
      note
    }
  }
}

Get information about a specific legislator

See in GraphiQL

{
  person(id:"ocd-person/dd05bd23-fe49-4e65-bfff-62db997e56e0"){
    name
    contactDetails {
      note
      type
      value
    }
    otherNames {
      name
    }
    sources {
      url
    }
    currentMemberships {
      organization {
        name
      }
    }
  }
}

Get legislators for a given state/chamber

See in GraphiQL

ocd-organization/ddf820b5-5246-46b3-a807-99b5914ad39f is the id of the Alabama Senate chamber.

{
  people(memberOf:"ocd-organization/ddf820b5-5246-46b3-a807-99b5914ad39f", first: 100) {
    edges {
      node {
        name
        party: currentMemberships(classification:"party") {
          organization {
            name

          }
        }
        links {
          url
        }
        sources {
          url
        }
        chamber: currentMemberships(classification:["upper", "lower"]) {
          post {
            label
          }
          organization {
            name
            classification
            parent {
              name
            }
          }
        }
      }
    }
  }
}

Search for legislators that represent a given area

See in GraphQL

{
  people(latitude: 40.7460022, longitude: -73.9584642, first: 100) {
    edges {
      node {
        name
        chamber: currentMemberships(classification:["upper", "lower"]) {
          post {
            label
          }
          organization {
            name
            classification
            parent {
              name
            }
          }
        }
      }
    }
  }
}