> ## Documentation Index
> Fetch the complete documentation index at: https://api.pollunit.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create participant

> Adds a participant to the poll, which is the object the votes of one person belong to. A private token creates the participant on behalf of its user, a public token creates it anonymously and the X-POLLUNIT-USER-IDENTIFIER header decides which anonymous user it belongs to. The call is idempotent for one user: a repeated request updates the existing participant instead of adding a second one. The poll has to be votable, and its participant limit and access restrictions apply.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/polls/{poll_id}/voters
openapi: 3.0.1
info:
  title: PollUnit API
  version: v1
  description: Programmatic access to PollUnit.
servers:
  - url: https://pollunit.com
    description: Production
  - url: http://localhost:3000
    description: Development
security:
  - bearerAuth: []
paths:
  /api/v1/polls/{poll_id}/voters:
    parameters:
      - name: poll_id
        in: path
        description: Poll member_hash or admin_hash
        required: true
        schema:
          type: string
      - name: organization_id
        in: query
        required: false
        description: >-
          public_id of an organization the user belongs to. When given, the
          request runs in that organization context instead of the personal
          account.
        schema:
          type: string
    post:
      tags:
        - Voters
      summary: Create participant
      description: >-
        Adds a participant to the poll, which is the object the votes of one
        person belong to. A private token creates the participant on behalf of
        its user, a public token creates it anonymously and the
        X-POLLUNIT-USER-IDENTIFIER header decides which anonymous user it
        belongs to. The call is idempotent for one user: a repeated request
        updates the existing participant instead of adding a second one. The
        poll has to be votable, and its participant limit and access
        restrictions apply.
      parameters:
        - name: X-POLLUNIT-USER-IDENTIFIER
          in: header
          required: false
          description: >-
            Your own identification of the user on whose behalf the request is
            made, any string. The user identifiers should not be guessable and
            stay secret, otherwise users could get access to other users'
            contents. Only used with a public API token: the created or changed
            object belongs to that anonymous user instead of the token owner,
            which keeps the user in control of it in later requests with the
            same identifier.
          schema:
            type: string
        - name: X-POLLUNIT-POLL-PASSWORD
          in: header
          required: false
          description: >-
            Access password of the poll. Only needed for password protected
            polls.
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VoterCreateRequest'
      responses:
        '200':
          description: voting fee has to be paid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VotingFeePayment'
        '201':
          description: participant created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Voter'
        '401':
          description: unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Unauthorized'
        '403':
          description: poll does not accept votes
        '404':
          description: poll not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFound'
        '422':
          description: invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
      security:
        - bearerAuth: []
components:
  schemas:
    VoterCreateRequest:
      type: object
      properties:
        voter:
          $ref: '#/components/schemas/VoterInput'
      required:
        - voter
    VotingFeePayment:
      type: object
      description: >-
        Returned instead of the participant when the poll charges a voting fee
        or asks for a donation. The participant already exists but stays unpaid
        until the payment page has been completed.
      properties:
        message:
          type: string
          example: Complete payment for voter
        url:
          type: string
          format: uri
          description: Payment page for this participant.
    Voter:
      type: object
      description: >-
        A participant of the poll. Which fields are returned depends on the poll
        type and on your access level: `complete` only for surveys,
        `required_option_votes_complete` only when the poll requires a vote on
        all options, and the moderation fields only with admin access.
      properties:
        id:
          type: string
          description: Voter public_id
        user_name:
          type: string
          nullable: true
          description: >-
            Name of the participant. A generated name when the poll has
            `anonymize_voter_names`.
        changed_by_admin:
          type: boolean
          nullable: true
          description: The votes of this participant were changed by an admin.
        complete:
          type: boolean
          nullable: true
          description: 'Surveys only: the participant finished the survey.'
        created_at:
          type: string
          format: date-time
          nullable: true
        updated_at:
          type: string
          format: date-time
          nullable: true
        fraudulent:
          type: boolean
          nullable: true
          description: Admin access only
        paid:
          type: boolean
          nullable: true
          description: >-
            Admin access only. `false` while a voting fee for this participant
            is still open.
        required_option_votes_complete:
          type: boolean
          nullable: true
          description: >-
            Admin access only, and only when the poll has
            `option_vote_requirement` `all_options`.
        privacy_policy_accepted:
          type: boolean
          nullable: true
          description: >-
            Admin access only, and only when the poll has
            `privacy_policy_for_voters`.
        terms_accepted:
          type: boolean
          nullable: true
          description: Admin access only, and only when the poll has `terms_for_voters`.
      required:
        - id
    Unauthorized:
      type: object
      properties:
        error:
          type: string
          example: Unauthorized
    NotFound:
      type: object
      properties:
        error:
          type: string
          example: Not Found
    Errors:
      type: object
      properties:
        error:
          type: string
          example: Unprocessable Entity
        errors:
          type: object
    VoterInput:
      type: object
      description: >-
        Attributes accepted when creating a participant. The fields the poll
        configuration makes mandatory are listed in the poll show response as
        `voter_required_fields`.
      properties:
        user_name:
          type: string
          nullable: true
          example: Jack
          description: >-
            Name of the participant. Required for anonymous participants unless
            the poll generates the names through `anonymize_voter_names` or does
            not require them. Ignored with a private token: the name of the
            token owner is used.
        additional_attributes:
          type: object
          nullable: true
          description: >-
            Values for the poll's `additional_attributes`, keyed by attribute
            id. Keys the poll does not define are dropped. Pass the double opt
            in address as `optin_email`.
        terms:
          type: boolean
          nullable: true
          description: >-
            Set to `true` (or `"true"` / `"1"`) to accept the poll's terms.
            Required when the poll has `terms_for_voters`.
        privacy_policy:
          type: boolean
          nullable: true
          description: >-
            Set to `true` (or `"true"` / `"1"`) to accept the poll's privacy
            policy. Required when the poll has `privacy_policy_for_voters`.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: opaque
      description: Personal API token — find yours under My Account → API.

````