Accounting Questions

Accounting questions allow users to ask and answer questions about specific documents or bank transactions. Questions can have multiple answer options and are used for clarifying accounting treatment during document processing.

Endpoints

List Questions

GET /api/v2/questions

Retrieves a paginated list of accounting questions.

Query Parameters

Parameter Type Required Description
client_account_id integer Yes ID of the client account
document_id integer No Filter by document/voucher ID
bank_transaction_id integer No Filter by bank transaction ID
status string No Filter by question status
order_by string No Sort field
page integer No Page number (default: 1)
per_page integer No Items per page (default: 25)

Note: The document_id query parameter above filters by the underlying document, but the field name in the request/response body is voucher_id (see Attributes) — the API uses different names for the same relationship in the query string and the JSON body.

Note: created_by and answer_options are not included by default — pass ?with=answer_options (or ?with=created_by,answer_options) to embed them, as shown below.

Response

{
  "data": [
    {
      "id": 1,
      "created_by_id": 7,
      "created_at": "2024-03-15T10:00:00Z",
      "client_account_id": 7,
      "voucher_id": 123,
      "bank_transaction_id": null,
      "question": "Which account should this expense be posted to?",
      "answer_action": "CHOOSE_OPTION",
      "question_status": "OPEN",
      "answer_options": [
        {
          "id": 1,
          "created_by_id": 7,
          "created_at": "2024-03-15T10:00:00Z",
          "question_id": 1,
          "option": "6300 - Office Supplies",
          "selected_answer": false
        },
        {
          "id": 2,
          "created_by_id": 7,
          "created_at": "2024-03-15T10:00:00Z",
          "question_id": 1,
          "option": "6800 - Other Operating Expenses",
          "selected_answer": false
        }
      ]
    }
  ],
  "meta": {
    "page": 1,
    "pages": 1,
    "per_page": 25,
    "records": 1
  }
}

The example above was requested with ?with=answer_options; omit the parameter to get the question without the answer_options field.

Get Question

GET /api/v2/questions/{id}

Retrieves a specific accounting question by ID.

Create Question

POST /api/v2/questions

Creates a new accounting question.

Request Body

Field Type Required Description
client_account_id integer Yes The client account ID
voucher_id integer One of voucher_id / bank_transaction_id ID of the related document/voucher
bank_transaction_id integer One of voucher_id / bank_transaction_id ID of the related bank transaction
question string Yes The question text
answer_action string Yes How the question is answered. See Answer Actions

Note: answer_options cannot be supplied on creation — it is not accepted by this endpoint, even for CHOOSE_OPTION questions. CHOOSE_OPTION questions with pre-populated options are created internally by Snapbooks’ own document-processing workflows, not through the public API.

Creating a duplicate open question (same client_account_id, voucher_id/bank_transaction_id, and answer_action) is rejected with a validation error.

Example Request

{
  "client_account_id": 7,
  "voucher_id": 123,
  "question": "What should this expense be categorized as?",
  "answer_action": "TYPE_ANSWER"
}

Response

Returns the created question with status 201 Created.

Answer Question

POST /api/v2/questions/{id}/answer

Submits an answer to an accounting question and closes it (question_status becomes CLOSED). Answering an already-closed question is a no-op. The request body shape depends on the question’s answer_action:

answer_action Request Body Description
CHOOSE_OPTION {"options": [<answer_option_id>, ...]} Marks the given answer option IDs as selected_answer: true
TYPE_ANSWER {"answer": "<text>"} Creates a new answer option with the free-text answer, selected
STATEMENT {"statement_id": <id>} Creates a new answer option referencing a statement, selected
ATTACH_FILE {"file_id": <id>} Creates a new answer option referencing an uploaded file, selected
BUSINESS_PARTNER {"business_partner_id": <id>} Creates a new answer option referencing a business partner (must belong to the question’s client account), selected
BANK_ACCOUNT {"bank_account_id": <id>} Creates a new answer option referencing a bank account (must belong to the question’s client account), selected

Example Request (TYPE_ANSWER)

{
  "answer": "6300 - Office Supplies"
}

Response

Returns the updated question with question_status: "CLOSED".

Answer Actions

Value Description
CHOOSE_OPTION The question is answered by selecting one or more of the provided answer_options
TYPE_ANSWER The question is answered with free-text
STATEMENT The question is answered by referencing a statement
ATTACH_FILE The question is answered by attaching an uploaded file
BUSINESS_PARTNER The question is answered by referencing a business partner
BANK_ACCOUNT The question is answered by referencing a bank account

Attributes

Accounting Question

Attribute Type Description
id integer Unique identifier (read-only)
created_by_id integer ID of the creating user (read-only)
created_at datetime Creation timestamp (read-only)
client_account_id integer ID of the client account
voucher_id integer ID of the related document/voucher. Filtered via the document_id query parameter on GET /questions (see note above)
bank_transaction_id integer ID of the related bank transaction
question string The question text
answer_action string How the question is answered. See Answer Actions
question_status string Current status of the question: OPEN or CLOSED

Answer Option

Attribute Type Description
id integer Unique identifier (read-only)
created_by_id integer ID of the creating user (read-only)
created_at datetime Creation timestamp (read-only)
question_id integer ID of the parent question (read-only)
option string The answer option text
selected_answer boolean Whether this option is selected

Relationships

Relationship Type Description
created_by User The user who created the question
answer_options AnswerOption[] Available answer options

Error Responses

Status Code Description
400 Invalid request (missing required fields, duplicate question)
403 Forbidden (no access to client account)
404 Question not found