# Get a questionnaire

Fetches a single questionnaire, scoped server-side to the caller's organization, including its submitted question/answer schema and metadata-only attached-file listings.

Endpoint: GET /public/v1/questionnaires/{questionnaireId}
Version: Beta

## Path parameters:

  - `questionnaireId` (string, required)
    Unique identifier of the questionnaire to fetch (bound from the {questionnaire_id} path parameter).

## Response 200:

  - `200` (unknown)
    A successful response.

## Response 200 fields (application/json):

  - `questionnaire` (object, required)
    A questionnaire sent (or staged to be sent) to a vendor, curated for public
consumption. Excludes internal ids beyond the public id, audit actors,
reviewer/suggestion provenance, and respondent PII beyond what the caller's
own organization already provided when creating it.

  - `questionnaire.id` (string, required)
    Unique identifier of the questionnaire.

  - `questionnaire.templateId` (string, required)
    Id of the template this questionnaire was created from.

  - `questionnaire.sent` (boolean, required)
    Whether the questionnaire has been sent to the vendor yet.

  - `questionnaire.createdAt` (string, required)
    When the questionnaire was created.

  - `questionnaire.questions` (array, required)
    The submitted question/answer schema, curated. Empty until the vendor
has submitted at least one answer. A draft/unsent questionnaire is
readable the same as a sent one — this is the caller's own org's data.

  - `questionnaire.questions.id` (string, required)
    Unique identifier of the question.

  - `questionnaire.questions.question` (string, required)
    The question text as presented to the vendor.

  - `questionnaire.questions.section` (string)
    The section heading this question is grouped under, if any.

  - `questionnaire.questions.schema` (string, required)
    Whether a question is a flat question or a table/master-table container.
- QUESTION_SCHEMA_UNSPECIFIED: Schema not set.
- QUESTION_SCHEMA_FLAT: Flat (non-table) question.
- QUESTION_SCHEMA_TABLE: Grid/table question.
- QUESTION_SCHEMA_MASTER: Master grid question (template for repeated table rows).
    Enum: "QUESTION_SCHEMA_UNSPECIFIED", "QUESTION_SCHEMA_FLAT", "QUESTION_SCHEMA_TABLE", "QUESTION_SCHEMA_MASTER"

  - `questionnaire.questions.answers` (array, required)
    Submitted answer(s) for a flat question. Empty for TABLE/MASTER
questions — see `rows` instead.

  - `questionnaire.questions.answers.id` (string, required)
    Unique identifier of the answer.

  - `questionnaire.questions.answers.schema` (string, required)
    How to interpret an Answer's `output`/`files`.
- ANSWER_SCHEMA_UNSPECIFIED: Schema not set.
- ANSWER_SCHEMA_SELECT: Single-choice select from a fixed option list.
- ANSWER_SCHEMA_TEXT: Free-form text response.
- ANSWER_SCHEMA_MULTISELECT: Multiple choices from a fixed option list.
- ANSWER_SCHEMA_FILE: File upload (see Answer.files).
- ANSWER_SCHEMA_DATE: Date value.
- ANSWER_SCHEMA_BOOLEAN: Yes/no boolean value.
    Enum: "ANSWER_SCHEMA_UNSPECIFIED", "ANSWER_SCHEMA_SELECT", "ANSWER_SCHEMA_TEXT", "ANSWER_SCHEMA_MULTISELECT", "ANSWER_SCHEMA_FILE", "ANSWER_SCHEMA_DATE", "ANSWER_SCHEMA_BOOLEAN"

  - `questionnaire.questions.answers.output` (string, required)
    The submitted value. For a FILE-schema answer this is typically empty —
see `files` instead.

  - `questionnaire.questions.answers.title` (string, required)
    Display title/label for this answer field.

  - `questionnaire.questions.answers.column` (string)
    Column header this answer belongs to, set only when it's a cell in a
table row (see AnswerRow).

  - `questionnaire.questions.answers.files` (array, required)
    Files submitted as this answer's response (FILE-schema answers),
metadata only.

  - `questionnaire.questions.answers.files.id` (string, required)
    Unique identifier of the file.

  - `questionnaire.questions.answers.files.name` (string, required)
    Display filename.

  - `questionnaire.questions.answers.files.mimeType` (string, required)
    MIME type of the file.

  - `questionnaire.questions.answers.files.createdAt` (string, required)
    When the file was uploaded.

  - `questionnaire.questions.files` (array, required)
    Files attached directly to this question (not to a specific answer),
metadata only — see File's doc comment for what's excluded.

  - `questionnaire.questions.rows` (array, required)
    One row per table/master-table sub-question. Empty for a flat question.

  - `questionnaire.questions.rows.answers` (array, required)
    Submitted answers making up this table/master-table row, one per column.

  - `questionnaire.questions.columns` (array, required)
    Column headers for `rows`, derived from the first row's answer titles.
Empty for a flat question.

## Response 400:

  - `400` (unknown)
    INVALID_ARGUMENT: the questionnaire_id is missing or not a valid identifier.

## Response 401:

  - `401` (unknown)
    UNAUTHENTICATED: access token is absent, malformed, or missing the required organization claim.

## Response 403:

  - `403` (unknown)
    PERMISSION_DENIED: access token does not include the assess-questionnaires.read scope.

## Response 404:

  - `404` (unknown)
    NOT_FOUND: no questionnaire with the given id exists within the caller's organization.

## Response default:

  - `default` (unknown)
    An unexpected error response.

## Response default fields (application/json):

  - `code` (integer, required)
    The status code, which should be an enum value of
[google.rpc.Code][google.rpc.Code].

  - `message` (string, required)
    A developer-facing error message, which should be in English. Any
user-facing error message should be localized and sent in the
[google.rpc.Status.details][google.rpc.Status.details] field, or localized
by the client.

  - `details` (array, required)
    A list of messages that carry the error details.  There is a common set of
message types for APIs to use.

  - `details.@type` (string)
    A URL/resource name that uniquely identifies the type of the serialized
protocol buffer message. This string must contain at least
one "/" character. The last segment of the URL's path must represent
the fully qualified name of the type (as in
`path/google.protobuf.Duration`). The name should be in a canonical form
(e.g., leading "." is not accepted).
In practice, teams usually precompile into the binary all types that they
expect it to use in the context of Any. However, for URLs which use the
scheme `http`, `https`, or no scheme, one can optionally set up a type
server that maps type URLs to message definitions as follows:
* If no scheme is provided, `https` is assumed.
* An HTTP GET on the URL must yield a [google.protobuf.Type][]
value in binary format, or produce an error.
* Applications are allowed to cache lookup results based on the
URL, or have them precompiled into a binary to avoid any
lookup. Therefore, binary compatibility needs to be preserved
on changes to types. (Use versioned type names to manage
breaking changes.)

Note: this functionality is not currently available in the official
protobuf release, and it is not used for type URLs beginning with
type.googleapis.com. As of May 2023, there are no widely used type server
implementations and no plans to implement one.
Schemes other than `http`, `https` (or the empty scheme) might be
used with implementation specific semantics.

