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

# Code Examples

> Code examples in multiple languages for common API operations

## Overview

This page provides code examples in multiple languages for common Gather API operations. Use these examples as starting points for your integration.

## Authentication

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    # Set your API key
    API_KEY="qapi_your-api-key-here"

    # Make request
    curl -X GET https://api.prod.qualifi.hr/qsi/gather/questions \
      -H "x-api-key: ${API_KEY}"
    ```
  </Tab>

  <Tab title="JavaScript">
    ```javascript theme={null}
    const apiKey = 'qapi_your-api-key-here';

    const response = await fetch('https://api.prod.qualifi.hr/qsi/gather/questions', {
      headers: {
        'x-api-key': apiKey
      }
    });

    const data = await response.json();
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import requests

    api_key = 'qapi_your-api-key-here'

    response = requests.get(
        'https://api.prod.qualifi.hr/qsi/gather/questions',
        headers={'x-api-key': api_key}
    )

    data = response.json()
    ```
  </Tab>

  <Tab title="Ruby">
    ```ruby theme={null}
    require 'net/http'

    api_key = 'qapi_your-api-key-here'

    uri = URI('https://api.prod.qualifi.hr/qsi/gather/questions')
    req = Net::HTTP::Get.new(uri)
    req['x-api-key'] = api_key

    response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
      http.request(req)
    end
    ```
  </Tab>
</Tabs>

## Create Question

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl -X POST https://api.prod.qualifi.hr/qsi/gather/questions \
      -H "x-api-key: ${API_KEY}" \
      -H "Content-Type: application/json" \
      -d '{
        "userId": "user-uuid",
        "title": "Tell me about yourself",
        "questionScript": "Tell me about yourself and your background.",
        "audioURL": "https://example.com/audio/question1.mp3"
      }'
    ```
  </Tab>

  <Tab title="JavaScript">
    ```javascript theme={null}
    const response = await fetch('https://api.prod.qualifi.hr/qsi/gather/questions', {
      method: 'POST',
      headers: {
        'x-api-key': apiKey,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        userId: 'user-uuid',
        title: 'Tell me about yourself',
        questionScript: 'Tell me about yourself and your background.',
        audioURL: 'https://example.com/audio/question1.mp3'
      })
    });

    const question = await response.json();
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    response = requests.post(
        'https://api.prod.qualifi.hr/qsi/gather/questions',
        headers={
            'x-api-key': api_key,
            'Content-Type': 'application/json'
        },
        json={
            'userId': 'user-uuid',
            'title': 'Tell me about yourself',
            'questionScript': 'Tell me about yourself and your background.',
            'audioURL': 'https://example.com/audio/question1.mp3'
        }
    )

    question = response.json()
    ```
  </Tab>

  <Tab title="Ruby">
    ```ruby theme={null}
    require 'net/http'
    require 'json'

    uri = URI('https://api.prod.qualifi.hr/qsi/gather/questions')
    req = Net::HTTP::Post.new(uri)
    req['x-api-key'] = api_key
    req['Content-Type'] = 'application/json'
    req.body = {
      userId: 'user-uuid',
      title: 'Tell me about yourself',
      questionScript: 'Tell me about yourself and your background.',
      audioURL: 'https://example.com/audio/question1.mp3'
    }.to_json

    response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
      http.request(req)
    end
    ```
  </Tab>
</Tabs>

## Create Interview

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl -X POST https://api.prod.qualifi.hr/qsi/gather/interviews \
      -H "x-api-key: ${API_KEY}" \
      -H "Content-Type: application/json" \
      -d '{
        "title": "Software Engineer Interview",
        "displayName": "Software Engineer Interview",
        "interviewType": "standard",
        "questionIds": ["question-id-1", "question-id-2"]
      }'
    ```
  </Tab>

  <Tab title="JavaScript">
    ```javascript theme={null}
    const response = await fetch('https://api.prod.qualifi.hr/qsi/gather/interviews', {
      method: 'POST',
      headers: {
        'x-api-key': apiKey,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        title: 'Software Engineer Interview',
        displayName: 'Software Engineer Interview',
        interviewType: 'standard',
        questionIds: ['question-id-1', 'question-id-2']
      })
    });

    const interview = await response.json();
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    response = requests.post(
        'https://api.prod.qualifi.hr/qsi/gather/interviews',
        headers={
            'x-api-key': api_key,
            'Content-Type': 'application/json'
        },
        json={
            'title': 'Software Engineer Interview',
            'displayName': 'Software Engineer Interview',
            'interviewType': 'standard',
            'questionIds': ['question-id-1', 'question-id-2']
        }
    )

    interview = response.json()
    ```
  </Tab>

  <Tab title="Ruby">
    ```ruby theme={null}
    uri = URI('https://api.prod.qualifi.hr/qsi/gather/interviews')
    req = Net::HTTP::Post.new(uri)
    req['x-api-key'] = api_key
    req['Content-Type'] = 'application/json'
    req.body = {
      title: 'Software Engineer Interview',
      displayName: 'Software Engineer Interview',
      interviewType: 'standard',
      questionIds: ['question-id-1', 'question-id-2']
    }.to_json

    response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
      http.request(req)
    end
    ```
  </Tab>
</Tabs>

## Create Candidate and Send Invite

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    # Create candidate
    curl -X POST https://api.prod.qualifi.hr/qsi/gather/candidates \
      -H "x-api-key: ${API_KEY}" \
      -H "Content-Type: application/json" \
      -d '{
        "firstName": "John",
        "lastName": "Doe",
        "email": "john.doe@example.com",
        "phone": "+1234567890"
      }'

    # Create candidate interview and send invite
    curl -X POST https://api.prod.qualifi.hr/qsi/gather/candidate-interviews \
      -H "x-api-key: ${API_KEY}" \
      -H "Content-Type: application/json" \
      -d '{
        "candidateId": "candidate-id",
        "interviewId": "interview-id",
        "sendInvite": true,
        "deliveryTypes": ["email"]
      }'
    ```
  </Tab>

  <Tab title="JavaScript">
    ```javascript theme={null}
    // Create candidate
    const candidateResponse = await fetch('https://api.prod.qualifi.hr/qsi/gather/candidates', {
      method: 'POST',
      headers: {
        'x-api-key': apiKey,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        firstName: 'John',
        lastName: 'Doe',
        email: 'john.doe@example.com',
        phone: '+1234567890'
      })
    });

    const candidate = await candidateResponse.json();

    // Create candidate interview and send invite
    const inviteResponse = await fetch('https://api.prod.qualifi.hr/qsi/gather/candidate-interviews', {
      method: 'POST',
      headers: {
        'x-api-key': apiKey,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        candidateId: candidate.data.id,
        interviewId: 'interview-id',
        sendInvite: true,
        deliveryTypes: ['email']
      })
    });

    const invite = await inviteResponse.json();
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    # Create candidate
    candidate_response = requests.post(
        'https://api.prod.qualifi.hr/qsi/gather/candidates',
        headers={
            'x-api-key': api_key,
            'Content-Type': 'application/json'
        },
        json={
            'firstName': 'John',
            'lastName': 'Doe',
            'email': 'john.doe@example.com',
            'phone': '+1234567890'
        }
    )

    candidate = candidate_response.json()

    # Create candidate interview and send invite
    invite_response = requests.post(
        'https://api.prod.qualifi.hr/qsi/gather/candidate-interviews',
        headers={
            'x-api-key': api_key,
            'Content-Type': 'application/json'
        },
        json={
            'candidateId': candidate['data']['id'],
            'interviewId': 'interview-id',
            'sendInvite': True,
            'deliveryTypes': ['email']
        }
    )

    invite = invite_response.json()
    ```
  </Tab>

  <Tab title="Ruby">
    ```ruby theme={null}
    # Create candidate
    candidate_uri = URI('https://api.prod.qualifi.hr/qsi/gather/candidates')
    candidate_req = Net::HTTP::Post.new(candidate_uri)
    candidate_req['x-api-key'] = api_key
    candidate_req['Content-Type'] = 'application/json'
    candidate_req.body = {
      firstName: 'John',
      lastName: 'Doe',
      email: 'john.doe@example.com',
      phone: '+1234567890'
    }.to_json

    candidate_response = Net::HTTP.start(candidate_uri.hostname, candidate_uri.port, use_ssl: true) do |http|
      http.request(candidate_req)
    end

    candidate = JSON.parse(candidate_response.body)

    # Create candidate interview and send invite
    invite_uri = URI('https://api.prod.qualifi.hr/qsi/gather/candidate-interviews')
    invite_req = Net::HTTP::Post.new(invite_uri)
    invite_req['x-api-key'] = api_key
    invite_req['Content-Type'] = 'application/json'
    invite_req.body = {
      candidateId: candidate['data']['id'],
      interviewId: 'interview-id',
      sendInvite: true,
      deliveryTypes: ['email']
    }.to_json

    invite_response = Net::HTTP.start(invite_uri.hostname, invite_uri.port, use_ssl: true) do |http|
      http.request(invite_req)
    end
    ```
  </Tab>
</Tabs>

## Get Interview Results

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl -X GET https://api.prod.qualifi.hr/qsi/gather/candidate-interviews/{id}/results \
      -H "x-api-key: ${API_KEY}"
    ```
  </Tab>

  <Tab title="JavaScript">
    ```javascript theme={null}
    const response = await fetch(
      `https://api.prod.qualifi.hr/qsi/gather/candidate-interviews/${candidateInterviewId}/results`,
      {
        headers: {
          'x-api-key': apiKey
        }
      }
    );

    const results = await response.json();
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    response = requests.get(
        f'https://api.prod.qualifi.hr/qsi/gather/candidate-interviews/{candidate_interview_id}/results',
        headers={'x-api-key': api_key}
    )

    results = response.json()
    ```
  </Tab>

  <Tab title="Ruby">
    ```ruby theme={null}
    uri = URI("https://api.prod.qualifi.hr/qsi/gather/candidate-interviews/#{candidate_interview_id}/results")
    req = Net::HTTP::Get.new(uri)
    req['x-api-key'] = api_key

    response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
      http.request(req)
    end

    results = JSON.parse(response.body)
    ```
  </Tab>
</Tabs>

## Create Team

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl -X POST https://api.prod.qualifi.hr/qsi/gather/teams \
      -H "x-api-key: ${API_KEY}" \
      -H "Content-Type: application/json" \
      -d '{
        "teams": [
          {
            "name": "Engineering Team",
            "displayName": "Engineering",
            "description": "Engineering and development team"
          }
        ]
      }'
    ```
  </Tab>

  <Tab title="JavaScript">
    ```javascript theme={null}
    const response = await fetch('https://api.prod.qualifi.hr/qsi/gather/teams', {
      method: 'POST',
      headers: {
        'x-api-key': apiKey,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        teams: [
          {
            name: 'Engineering Team',
            displayName: 'Engineering',
            description: 'Engineering and development team'
          }
        ]
      })
    });

    const teams = await response.json();
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    response = requests.post(
        'https://api.prod.qualifi.hr/qsi/gather/teams',
        headers={
            'x-api-key': api_key,
            'Content-Type': 'application/json'
        },
        json={
            'teams': [
                {
                    'name': 'Engineering Team',
                    'displayName': 'Engineering',
                    'description': 'Engineering and development team'
                }
            ]
        }
    )

    teams = response.json()
    ```
  </Tab>
</Tabs>

## Create User

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl -X POST https://api.prod.qualifi.hr/qsi/gather/users \
      -H "x-api-key: ${API_KEY}" \
      -H "Content-Type: application/json" \
      -d '{
        "users": [
          {
            "firstName": "John",
            "lastName": "Doe",
            "email": "john.doe@example.com",
            "teamIds": ["team-uuid"]
          }
        ]
      }'
    ```
  </Tab>

  <Tab title="JavaScript">
    ```javascript theme={null}
    const response = await fetch('https://api.prod.qualifi.hr/qsi/gather/users', {
      method: 'POST',
      headers: {
        'x-api-key': apiKey,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        users: [
          {
            firstName: 'John',
            lastName: 'Doe',
            email: 'john.doe@example.com',
            teamIds: ['team-uuid']
          }
        ]
      })
    });

    const users = await response.json();
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    response = requests.post(
        'https://api.prod.qualifi.hr/qsi/gather/users',
        headers={
            'x-api-key': api_key,
            'Content-Type': 'application/json'
        },
        json={
            'users': [
                {
                    'firstName': 'John',
                    'lastName': 'Doe',
                    'email': 'john.doe@example.com',
                    'teamIds': ['team-uuid']
                }
            ]
        }
    )

    users = response.json()
    ```
  </Tab>
</Tabs>

## Copy Interview

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl -X POST https://api.prod.qualifi.hr/qsi/gather/interviews/{interviewId}/copy \
      -H "x-api-key: ${API_KEY}" \
      -H "Content-Type: application/json" \
      -d '{
        "teamId": "target-team-uuid",
        "copyKeywords": false
      }'
    ```
  </Tab>

  <Tab title="JavaScript">
    ```javascript theme={null}
    const response = await fetch(
      `https://api.prod.qualifi.hr/qsi/gather/interviews/${interviewId}/copy`,
      {
        method: 'POST',
        headers: {
          'x-api-key': apiKey,
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({
          teamId: 'target-team-uuid',
          copyKeywords: false
        })
      }
    );

    const interview = await response.json();
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    response = requests.post(
        f'https://api.prod.qualifi.hr/qsi/gather/interviews/{interview_id}/copy',
        headers={
            'x-api-key': api_key,
            'Content-Type': 'application/json'
        },
        json={
            'teamId': 'target-team-uuid',
            'copyKeywords': False
        }
    )

    interview = response.json()
    ```
  </Tab>
</Tabs>

## List Survey Questions

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl -X GET "https://api.prod.qualifi.hr/qsi/gather/survey-questions?page=0&pageSize=50" \
      -H "x-api-key: ${API_KEY}"
    ```
  </Tab>

  <Tab title="JavaScript">
    ```javascript theme={null}
    const params = new URLSearchParams({
      page: '0',
      pageSize: '50'
    });

    const response = await fetch(
      `https://api.prod.qualifi.hr/qsi/gather/survey-questions?${params}`,
      {
        headers: {
          'x-api-key': apiKey
        }
      }
    );

    const surveyQuestions = await response.json();
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    params = {
        'page': 0,
        'pageSize': 50
    }
    response = requests.get(
        'https://api.prod.qualifi.hr/qsi/gather/survey-questions',
        headers={'x-api-key': api_key},
        params=params
    )

    surveyQuestions = response.json()
    ```
  </Tab>
</Tabs>

## Get Analytics

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl -X GET "https://api.prod.qualifi.hr/qsi/gather/analytics?startDate=2024-01-01&endDate=2024-01-31" \
      -H "x-api-key: ${API_KEY}"
    ```
  </Tab>

  <Tab title="JavaScript">
    ```javascript theme={null}
    const params = new URLSearchParams({
      startDate: '2024-01-01',
      endDate: '2024-01-31'
    });

    const response = await fetch(
      `https://api.prod.qualifi.hr/qsi/gather/analytics?${params}`,
      {
        headers: {
          'x-api-key': apiKey
        }
      }
    );

    const analytics = await response.json();
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    params = {
        'startDate': '2024-01-01',
        'endDate': '2024-01-31'
    }
    response = requests.get(
        'https://api.prod.qualifi.hr/qsi/gather/analytics',
        headers={'x-api-key': api_key},
        params=params
    )

    analytics = response.json()
    ```
  </Tab>
</Tabs>

## Update Team Branding

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl -X PATCH https://api.prod.qualifi.hr/qsi/gather/teams/{teamId}/branding \
      -H "x-api-key: ${API_KEY}" \
      -H "Content-Type: application/json" \
      -d '{
        "accentColor": "482eeb",
        "teamButtonColor": "ffffff",
        "logoUrl": "https://example.com/logo.png"
      }'
    ```
  </Tab>

  <Tab title="JavaScript">
    ```javascript theme={null}
    const response = await fetch(
      `https://api.prod.qualifi.hr/qsi/gather/teams/${teamId}/branding`,
      {
        method: 'PATCH',
        headers: {
          'x-api-key': apiKey,
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({
          accentColor: '482eeb',
          teamButtonColor: 'ffffff',
          logoUrl: 'https://example.com/logo.png'
        })
      }
    );

    const team = await response.json();
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    response = requests.patch(
        f'https://api.prod.qualifi.hr/qsi/gather/teams/{team_id}/branding',
        headers={
            'x-api-key': api_key,
            'Content-Type': 'application/json'
        },
        json={
            'accentColor': '482eeb',
            'teamButtonColor': 'ffffff',
            'logoUrl': 'https://example.com/logo.png'
        }
    )

    team = response.json()
    ```
  </Tab>
</Tabs>

## Related Resources

<CardGroup cols={2}>
  <Card title="API Reference" icon="code" href="/api-reference/questions">
    Complete API reference documentation
  </Card>

  <Card title="Quick Start" icon="rocket" href="/getting-started/quickstart">
    Get started with the API
  </Card>
</CardGroup>
