> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.thymia.ai/api-reference/thymia-api/questionnaires/llms.txt.
> For full documentation content, see https://docs.thymia.ai/api-reference/thymia-api/questionnaires/llms-full.txt.

# Get questionnaire status and results

GET /v1/questionnaires/{questionnaire_id}

Retrieves the status of an existing questionnaire, including results if they are available.

Reference: https://docs.thymia.ai/api-reference/thymia-api/questionnaires/get-questionnaire-v-1-questionnaires-questionnaire-id-get

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Thymia API
  version: 1.0.0
paths:
  /v1/questionnaires/{questionnaire_id}:
    get:
      operationId: get-questionnaire-v-1-questionnaires-questionnaire-id-get
      summary: Get questionnaire status and results
      description: >-
        Retrieves the status of an existing questionnaire, including results if
        they are available.
      tags:
        - subpackage_questionnaires
      parameters:
        - name: questionnaire_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: x-api-key
          in: header
          description: Your API Activation Key
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuestionnaireResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    QuestionnaireStatus:
      type: string
      enum:
        - RESULTS_NOT_AVAILABLE
        - RESULTS_AVAILABLE
      description: An enumeration.
      title: QuestionnaireStatus
    CompletedQuestionnaireDetailsQuestions:
      type: object
      properties: {}
      description: Definition of the questions asked in the questionnaire
      title: CompletedQuestionnaireDetailsQuestions
    CompletedQuestionnaireDetailsAnswers:
      type: object
      properties: {}
      description: >-
        Answers given by user. In case of multiple choice questions, answers
        refer to options by id.
      title: CompletedQuestionnaireDetailsAnswers
    QuestionnaireScoreDetailsScoreMetadata:
      type: object
      properties: {}
      description: Metadata to make sense of the score
      title: QuestionnaireScoreDetailsScoreMetadata
    QuestionnaireScoreDetails:
      type: object
      properties:
        score:
          type: integer
          description: Overall score given to this questionnaire response
        scoreMetadata:
          $ref: '#/components/schemas/QuestionnaireScoreDetailsScoreMetadata'
          description: Metadata to make sense of the score
      required:
        - score
        - scoreMetadata
      title: QuestionnaireScoreDetails
    CompletedQuestionnaireDetails:
      type: object
      properties:
        completedAt:
          type: string
          format: date-time
          description: When the questionnaire was completed
        name:
          type: string
          description: Name of the questionnaire as seen by the user completing it
        questions:
          $ref: '#/components/schemas/CompletedQuestionnaireDetailsQuestions'
          description: Definition of the questions asked in the questionnaire
        answers:
          $ref: '#/components/schemas/CompletedQuestionnaireDetailsAnswers'
          description: >-
            Answers given by user. In case of multiple choice questions, answers
            refer to options by id.
        scoreDetails:
          $ref: '#/components/schemas/QuestionnaireScoreDetails'
          description: >-
            Details of the score given to this questionnaire response. Only
            applies to questionnaires that can be scored
      required:
        - completedAt
        - name
        - questions
        - answers
      title: CompletedQuestionnaireDetails
    QuestionnaireResponse:
      type: object
      properties:
        status:
          $ref: '#/components/schemas/QuestionnaireStatus'
          description: >-
            Current status of the questionnaire. Possible values:

            * `RESULTS_NOT_AVAILABLE`: Questionnaire has not been completed yet

            * `RESULTS_AVAILABLE`: Questionnaire has been completed and results
            are available
                    
        details:
          $ref: '#/components/schemas/CompletedQuestionnaireDetails'
          description: Only populated if `status` is `RESULTS_AVAILABLE`
      required:
        - status
      title: QuestionnaireResponse
    ValidationErrorLocItems:
      oneOf:
        - type: string
        - type: integer
      title: ValidationErrorLocItems
    ValidationError:
      type: object
      properties:
        loc:
          type: array
          items:
            $ref: '#/components/schemas/ValidationErrorLocItems'
        msg:
          type: string
        type:
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
    HTTPValidationError:
      type: object
      properties:
        detail:
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
      title: HTTPValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: x-api-key
      description: Your API Activation Key

```

## SDK Code Examples

```python
import requests

url = "https://api.example.com/v1/questionnaires/questionnaire_id"

payload = {}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.get(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.example.com/v1/questionnaires/questionnaire_id';
const options = {
  method: 'GET',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/v1/questionnaires/questionnaire_id"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("GET", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/questionnaires/questionnaire_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.example.com/v1/questionnaires/questionnaire_id")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.example.com/v1/questionnaires/questionnaire_id', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.example.com/v1/questionnaires/questionnaire_id");
var request = new RestRequest(Method.GET);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/questionnaires/questionnaire_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```