---
title: "Set variables in an interview session"
method: POST
path: "/api/session"
tags: ["Sessions"]
---

# Set variables in an interview session

`POST /api/session`

Sets variables in the interview dictionary and (by default) returns a
JSON representation of the current question. Supports file uploads via
`multipart/form-data`; when uploading files, use `multipart/form-data`
and encode complex parameters as JSON strings.

## Request body

- SessionPostBody — Request body for `POST /api/session` when sending `application/json`. Complex values (`variables`, `delete_variables`, `event_list`, `file_variables`) may be passed as native JSON types.
  - `i` string, required — Interview filename (e.g. `docassemble.demo:data/questions/questions.yml`).
  - `session` string, required — Session ID.
  - `secret` string — Encryption secret (required if the session uses encryption).
  - `variables` object — Key/value pairs of variables to set in the interview dictionary.
  - `raw` 0 | 1 — Set to `0` to skip automatic conversion of dates and DAObjects. Defaults to `1` (conversion enabled).
  - `question_name` string — Name of the question being answered (needed for mandatory questions).
  - `question` 0 | 1 — Set to `0` to update variables without evaluating the interview or returning the current question. Default is `1`.
  - `advance_progress_meter` 0 | 1 — Set to `1` to advance the progress meter.
  - `overwrite` 0 | 1 — Set to `1` to overwrite the previous step instead of creating a new one.
  - `delete_variables` string[] — Variable names to delete (after `variables` are set).
  - `file_variables` object — Maps upload field names to interview variable names when the field name cannot be used directly as the variable name.
  - `event_list` string[] — List of variable names that triggered the current question.

## Response `200`

Current question as JSON (returned when `question` is not 0).

- object

## Other responses

- `204` — Empty response when `question` is set to 0.
- `400` — Bad request.
- `403` — Access denied.

---

[API](https://skmtc.dev/docassemble/apis/docassemble-api.md) · [All operations](https://skmtc.dev/docassemble/apis/docassemble-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/docassemble/docassemble-api/revisions/a75d7eea6826/schema)
