Civic Engine Developer Documentation

website·Indexed 34 days ago

https://developers.civicengine.com

Developer resources for Civic Engine, featuring a comprehensive GraphQL API reference for voting locations, elections, and candidates, as well as guides for embedding civic components and using the partnership widget.

Tokens
46.9K
Snippets
273
Records
471
Agent score
57%

What's inside Civic Engine

  1. Overview of Civic Flow web components

    Civic Flow is an embeddable web component used to engage and mobilize constituents. It allows campaigns to generate leads, guide users through customizable civic action flows, and provide optimized election tools to increase conversion rates.
  2. Query fields for the VotingLocation GraphQL object

    The VotingLocation object provides details about a specific polling place or voting site. It includes geographic information, administrative identifiers, and relationships to the associated election and political party.
    # Available fields on the VotingLocation object
    {
      address: Address       # The physical address of the location
      createdAt: DateTime!  # ISO8601 timestamp of record creation
      databaseId: Int!       # Internal database identifier
      election: Election!    # The election this location is associated with
      geoId: String          # Geographic identifier
      id: ID!                # Unique GraphQL ID
      mtfcc: String          # MTFCC code (if applicable)
      name: String           # Name of the voting location
      party: Party           # Associated political party
      precinct: String       # The precinct associated with this location
    }
  3. RegistrationOption GraphQL Object Reference

    The RegistrationOption object provides details about the requirements and characteristics of a specific voter registration method. It implements the DatabaseIdentifiable, Node, and Timestamps interfaces.
    type RegistrationOption implements DatabaseIdentifiable, Node, Timestamps {
      availableIfDateOfBirthBeforeOrEquals: ISO8601Date
      channel: RegistrationOptionChannel!
      createdAt: ISO8601DateTime!
      databaseId: Int!
      documents: [String!]!
      eligibility: [String!]!
      features: [RegistrationOptionFeature!]!
      id: ID!
      isIdRequired: Boolean!
      isPreregistration: Boolean!
      place: Place!
      safestRegistrationDeadlineInDays: Int
      updatedAt: ISO8601DateTime!
    }
  4. Election GraphQL Object Reference

    The Election object provides comprehensive data about a specific election, including its timing, naming, and associated voting components. It implements DatabaseIdentifiable, HasRaces, Node, Slug, and Timestamps interfaces.
    type Election implements DatabaseIdentifiable, HasRaces, Node, Slug, Timestamps {
      ballotsSentOutBy: ISO8601Date
      candidateInformationPublishedAt: ISO8601DateTime
      createdAt: ISO8601DateTime!
      databaseId: Int!
      defaultTimeZone: String!
      electionDay: ISO8601Date!
      id: ID!
      measures(after: String, before: String, first: Int, last: Int): MeasureConnection!
      milestones(filterBy: MilestoneFilter): [Milestone!]!
      name: String!
      originalElectionDate: ISO8601Date!
      raceCount: Int!
      races(after: String, before: String, filterBy: RaceFilter, first: Int, last: Int, orderBy: RaceOrder): RaceConnection!
      slug: String!
      state: String
      timezone: String!
      updatedAt: ISO8601DateTime!
      vipElections: [VipElection!]!
      votingDays(after: String, before: String, first: Int, last: Int): VotingDayConnection!
      votingInformationPublishedAt: ISO8601DateTime
      votingLocations(after: String, before: String, first: Int, last: Int): VotingLocationConnection!
    }
  5. Query the Body GraphQL object

    The Body object represents a governing body in the CivicEngine API. It contains metadata about the body, such as its database ID, geographic ID, and MTFCC code, as well as a connection to its members.
    # Example fields available on the Body object
    {
      id
      databaseId
      geoId
      mtfcc
      createdAt
      bodyMembers(first: 10, after: "cursor") { 
        edges {
          node {
            # Member details
          }
        }
      }
    }
  6. Query Position object fields in GraphQL

    The Position object represents a unique office that individuals can run for or hold. It includes details about election rules, ballot placement, and administrative data.
    # Example query for Position fields
    query {
      position(id: "...") {
        slug
        seats
        selectionsAllowed
        rowOrder
        tier
        retention
        runningMateStyle
        rankedChoiceMaxVotesGeneral
        rankedChoiceMaxVotesPrimary
        subAreaName
        subAreaValue
        salary
        staggeredTerm
        retiredAt
        updatedAt
      }
    }
  7. Use the VotingLocation GraphQL object

    The VotingLocation object represents ballot drop boxes and in-person voting locations. Note that it generally does not include precinct-based voting locations available only on election day. When querying by latitude/longitude, the API returns voting locations available at that specific location. The mtfcc and geoId fields indicate the geographic area (usually the county) the location is available to.
    type VotingLocation implements DatabaseIdentifiable, GeographicalIdentifiers, Node, Timestamps {
      address: Address
      createdAt: ISO8601DateTime!
      databaseId: Int!
      election: Election!
      geoId: String
      id: ID!
      mtfcc: String
      name: String
      party: Party
      precinct: String
      timezone: String!
      updatedAt: ISO8601DateTime!
      votingDays(
        after: String
        before: String
        first: Int
        last: Int
      ): VotingDayConnection!
    }
  8. Query government bodies using the bodies GraphQL query

    The bodies query allows you to retrieve information about specific government bodies, such as state legislatures or school boards. It returns a BodyConnection object. Note that not all positions are associated with a body.
    bodies(
      after: String
      before: String
      filterBy: BodyFilter
      first: Int
      last: Int
      location: LocationFilter
    ): BodyConnection!
  9. Query the Race GraphQL object

    The Race object represents a unique instance of a position and election combination. It is used to retrieve details about the nature of a race (e.g., whether it is a primary, runoff, or recall), the associated position, the election it belongs to, and the candidates running in that race.
    type Race implements DatabaseIdentifiable, HasCandidacies, Node, Timestamps {
      candidacies(includeUncertified: Boolean, includeUnpublished: Boolean = true): [Candidacy!]!
      createdAt: ISO8601DateTime!
      databaseId: Int!
      election: Election!
      filingPeriods: [FilingPeriod!]!
      id: ID!
      isDisabled: Boolean
      isPartisan: Boolean
      isPrimary: Boolean!
      isRecall: Boolean!
      isRunoff: Boolean!
      isUnexpired: Boolean!
      position: Position!
      seats: Int
      updatedAt: ISO8601DateTime!
    }
  10. Query biographical and professional data using the Person object

    The Person object contains biographical information for candidates and officeholders in the CivicEngine database. It stores data such as education, professional experience, and contact details.

    Key Usage Notes:

    • For issue stances or endorsements, query the Candidacy object.
    • For term dates or office locations, query the OfficeHolder object.
    • email and phone fields are deprecated; use the contacts field instead.
    • headshot is deprecated; use the images field instead.
    type Person implements DatabaseIdentifiable, HasCandidacies, HasOfficeHolders, Node, Slug, Timestamps {
      bioText: String
      bioguideId: String
      candidacies(includeUncertified: Boolean, includeUnpublished: Boolean = true): [Candidacy!]!
      contacts: [Contact!]!
      createdAt: ISO8601DateTime!
      databaseId: Int!
      degrees: [Degree!]!
      experiences: [Experience!]!
      firstName: String
      fullName: String!
      id: ID!
      images: [ImageUrl!]!
      lastName: String
      middleName: String
      nickname: String
      officeHolders(after: String, before: String, filterBy: OfficeHolderFilter, first: Int, last: Int, orderBy: OfficeHolderOrder): OfficeHolderConnection!
      slug: String!
      suffix: String
      updatedAt: ISO8601DateTime!
      urls(limit: Int = 20): [Url!]!
    }