---
swagger: '2.0'
info:
  version: 1.0.0
  title: GiveCampus Constituents API
  description: |-
    The Constituents API allows your school to securely retrieve constituent data in JSON format. <h2>Security</h2> <p>Every API request must have a bearer token attached in the Authorization header.</p> <p>These tokens are generated within the GiveCampus UI and only school administrators with super-user permissions can generate and manage them. You will choose this initial set of “full” administrators during the GiveCampus onboarding process.</p> <p>All API responses will be delivered over a secure HTTPS connection, and a TLS version of 1.2 or 1.3 is required.</p> <p>GiveCampus maintains detailed logs of API access and can provide them to your team upon request.</p> <h2>Request Lifecycle</h2> <p>The API delivers data asynchronously using a request-and-poll pattern:</p> <ol>
      <li><strong>Submit your request</strong> — Call the endpoint with your desired parameters. You'll receive a <code>request_id</code> and a <code>status</code> of <code>in_progress</code>.</li>
      <li><strong>Poll for results</strong> — Call <code>/results/{request_id}</code> every 2–5 seconds until <code>status</code> changes to <code>completed</code> (or <code>error</code>).</li>
      <li><strong>Download your data</strong> — When complete, the response includes a <code>download_url</code> containing a JSON array of objects matching the model defined below.</li>
    </ol> <p>Most requests complete within a few seconds.</p> <h2>Testing</h2> <p>You can use the tools below to see responses from the API to understand how to build your own implementation.</p> <p>You will see the URLs and paths necessary to make your own API calls.</p> <ol>
      <li>Click the Authorize button below to enter in your API Key in the following format: <code>Bearer API_TOKEN</code></li>
      <li>After authorized, you can click the close button in the authorization modal to start making requests</li>
      <li>Expand the Constituents section below to see the available parameters that you can leverage to filter API results.</li>
      <li>After requesting a subset of constituents, you will receive a <code>request_id</code>.  Copy that ID and then use that in the <code>results</code> section to see the progress of your request and to see the download URL once the request is completed.</li>
    </ol> <p>In the routes section below, there is a "Try it out" button.  After authenticating, you can select from the available parameters, and you will see the curl request performed, the results of your request, and any errors if applicable.</p> <p><i>GiveCampus Proprietary and Confidential</i></p>
basePath: "/api"
securityDefinitions:
  Bearer:
    type: apiKey
    name: Authorization
    in: header
    description: Enter the token with the `Bearer ` prefix, e.g. "Bearer XXXXXXXXXXXXX".
paths:
  "/constituents":
    get:
      tags:
      - Retrieve a list of constituents
      summary: Find your constituents
      description: |-
        <p>This endpoint will submit a request to retrieve constituents based on the supplied parameters.</p> <p>The results of this request is a JSON object that contains the following:</p>
          <ol>
            <li>request_id</li>
            <li>state</li>
          </ol>
        <p>Once you receive the <code>request_id</code>, you can make a subsequent request to the <code>results</code> operation listed on this page.</p> <p>You will take this id to check the <code>state</code> of the request and once it is <code>completed</code> you will have a valid <code>download_url</code> that will contain the data from the original constituents request</p>
      operationId: findConstituents
      produces:
      - application/json
      security:
      - Bearer: []
      responses:
        '200':
          description: returns a request id that can be used to make further requests
          schema:
            "$ref": "#/definitions/ApiRequest"
        '400':
          description: Invalid request
    post:
      tags:
      - Create a constituent
      summary: Create a constituent
      description: "<p>This endpoint allows you to create constituents.</p> <p>When
        providing affiliations, relationships, or solicit codes, they need to exist
        in the GC system for constituent records to be created.</p> <p><strong>Note:</strong>
        You can only create up tp 5,000 constituents per request.</p>"
      operationId: createConstituents
      produces:
      - application/json
      parameters:
      - in: body
        name: Constituent Details
        schema:
          type: array
          items:
            allOf:
            - "$ref": constituent_object_part_1.yaml
            - "$ref": constituent_object_part_2.yaml
            - "$ref": constituent_object_part_3.yaml
      security:
      - Bearer: []
      responses:
        '200':
          description: returns a request id that can be used to make further requests
          schema:
            "$ref": "#/definitions/ApiRequest"
        '400':
          description: Invalid request
    put:
      tags:
      - Update constituents
      summary: Update constituents
      description: "<p>This endpoint allows you to update constituents.</p> <p><code>gc_constituent_id</code>
        is used as the key to lookup and update a constituent.</p> <p>When providing
        affiliations, relationships, or solicit codes, they need to exist in the GC
        system for constituent records to be created.</p> <p><strong>Note:</strong>
        You can only update up tp 5,000 constituents per request.</p>"
      operationId: updateConstituents
      produces:
      - application/json
      parameters:
      - in: body
        name: Constituent Details
        schema:
          type: array
          items:
            allOf:
            - "$ref": constituent_object_part_1.yaml
            - type: object
              properties:
                gc_constituent_id:
                  description: GiveCampus ID for the constituent
                  example: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
                  type: string
                  format: uuid
            - "$ref": constituent_object_part_2.yaml
            - "$ref": constituent_object_part_3.yaml
      security:
      - Bearer: []
      responses:
        '200':
          description: returns a request id that can be used to make further requests
          schema:
            "$ref": "#/definitions/ApiRequest"
        '400':
          description: Invalid request
  "/results/{request_id}":
    get:
      tags:
      - Results
      summary: Get your results
      description: Returns the results of your request, like constituents
      operationId: findResults
      produces:
      - application/json
      parameters:
      - in: path
        name: request_id
        schema:
          type: string
        required: true
        description: Request ID
      security:
      - Bearer: []
      responses:
        '200':
          description: returns a status and download url for your request
          schema:
            "$ref": "#/definitions/ApiResults"
        '202':
          description: returns a status for your request
          schema:
            "$ref": "../shared/types/in_progress_api_results.yaml"
        '400':
          description: Invalid request
definitions:
  GetConstituents:
    description: The following fields are returned per constituent in an array in
      the downloaded file from the Constituents API
    allOf:
    - "$ref": constituent_object_part_1.yaml
    - type: object
      properties:
        gc_constituent_id:
          description: GiveCampus ID for the constituent
          example: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
          type: string
          format: uuid
    - "$ref": constituent_object_part_2.yaml
    - type: object
      properties:
        timestamps:
          description: Times associated to the constituent
          type: object
          properties:
            created_at:
              description: Timestamp for when the constituent was created in Unix
                time
              example: 1672549200
              type: integer
            updated_at:
              description: Timestamp for the last time the constituent was updated
                in Unix time
              example: 1672549200
              type: integer
    - "$ref": constituent_object_part_3.yaml
  ApiRequest:
    "$ref": "../shared/types/api_request.yaml"
  ApiResults:
    "$ref": "../shared/types/api_results.yaml"
