Skip to main content
Set what Truv returns for the documents a user uploads. A docs scenario pairs a set of filenames with the employment data those files should yield, and serves it when a user uploads files with those names in Truv Bridge or your backend sends them to a document collection. It drives the document upload path of Income & Employment and Employment History. Use it when Truv’s test documents don’t produce the result you need: a paystub with your own numbers, a 1099-NEC for a contractor, a volunteer hours log, a military permanent change of station (PCS) order, or a validation failure on a file of your own. For the shared concepts, read Custom Sandbox Data first.

How it works

A document upload scenario has no login. Each part of the request has its own role:
  • The uploaded filenames select the scenario.
  • The uploaded document types decide which records come back. See How uploads map to records.
  • The scenario’s payload supplies the values of those records. Truv doesn’t read them from the files.
  • Each record’s document_id picks the downloadable file served with it.
filenames and document_id both name entries in your sandbox document library: test files you upload with POST /v1/sandbox/documents/. They don’t have to name the same entry. A record can serve the file the user uploaded or any other file in your library.
1

Upload the files to your library

One entry per file the user will upload. The entry’s filename is what the scenario matches on.
2

Create the scenario

Set filenames to those names. On each paystub, W-2, or other record, set document_id to the id of the library entry to serve as that record’s file.
3

Upload the files in a verification

In Truv Bridge, or through the Document Collections API, upload files with those names. Truv serves your payload as the task result and attaches the library files.

Create a scenario [Server-side]

Truv’s own test document filenames are reserved, both in the library and in filenames, and the API refuses them with reserved_credential. Compared without regard to case, the reserved set includes: the paystubs first.paystub.pdf, most.recent.paystub.pdf, next.recent.paystub.pdf, hi.first.paystub.pdf, hi.most.recent.paystub.pdf, and hi.next.recent.paystub.pdf; the W-2s w2.pdf and hi.w2.pdf; the tax forms 1099div.pdf, 1099g.pdf, 1099int.pdf, 1099misc.pdf, 1099nec.pdf, 1099r.pdf, ssa1099.pdf, and f1040.pdf; and the volunteer documents volunteer_letter.pdf and volunteer_timesheet.pdf. Other names can be reserved as well, and the set grows as Truv publishes new test files, so use a distinctive prefix, such as acme..
First, upload the paystub PDF to the library:
The response is the library entry. Keep its id; the scenario below references it as the paystub’s document_id. uploaded_file and documents are abbreviated here.
Then create the scenario, matching on that filename. The paystub values come from payload; Truv doesn’t read them from the PDF, and document_id only names the library file served as the paystub. Replace YOUR_DOCUMENT_ID with the id the upload returned:
data_source is omitted here because filenames fits only the document upload data source, so Truv infers it. The response is the stored scenario with data_source: "docs".

Use it in Bridge

Start a sandbox verification and choose to upload documents instead of connecting a payroll provider. Upload a file named acme.paystub.pdf as a paystub. Only the name selects the scenario, and only the document type you pick for the upload decides which records it receives; the paystub Truv serves is the library file you referenced. The task completes with your data, and the paystub is downloadable through Pay Statements like any other connection.

Use it with the Document Collections API

Upload a file named acme.paystub.pdf to a document collection under a sandbox key. The library entry stands in for Truv’s classification, so the collection reports the documents the entry declares, and finalizing the collection runs the same document upload task, which resolves your scenario by filename. See Document Collections API for what each piece of library metadata controls.

Matching fields

A scenario matches an upload that includes every file it names; extra uploaded files don’t disqualify it. When several scenarios match, a scenario whose names are exactly the uploaded files wins over one that names only some of them, and among partial matches the one naming more files wins. The match is exact apart from case: the suspicious. prefix that flags Truv’s own test files is not stripped here, so a user who uploads suspicious.acme.paystub.pdf doesn’t reach a scenario naming acme.paystub.pdf. Use flags.is_suspicious to author a suspicious result instead. products restricts the scenario to income, employment, or both. Empty, the default, matches both.

Behavior

Document upload has no login step, so a scenario can only end the way a parse ends. behavior_status accepts done, error, no_data, config_error, and unavailable; behavior_mfa is refused. behavior_duration_seconds holds the task before it finishes. See Behavior for the fields. The payload’s flags add two outcomes a parse can reach with data:

How uploads map to records

Truv serves your payload against what the user actually uploaded, counting the uploads by document type: the type the user picked for each file in Truv Bridge, or the type the collection recognized from your library entry’s documents. One scenario can answer a one-paystub upload and a three-paystub upload alike. Only the first employment is served, so a document upload scenario returns one employer.
Support for multiple employments in document upload scenarios is in progress and coming soon.
Truv reads the other employments only to compare them with the first. That is how you set up the inconsistency cases that Truv’s test files cover:
Truv matches the employer name against its company catalog, as it does for production uploads, and reports the catalog’s name when it finds a match. A scenario with "company": { "name": "Acme Inc." } can come back as ACME. Don’t assert on the exact company.name in your tests. The match is fuzzy, so a made-up name can still match a real employer.

Document Collections API

A document collection under a sandbox key looks up every uploaded file in your library by filename. When it finds an entry, the entry’s test metadata replaces what Truv would otherwise have found in the file: A file with no library entry gets Truv’s filename-driven test behavior. Set the metadata on upload or with PATCH /v1/sandbox/documents/{id}/; see Test metadata.

Payload reference

The payload object contains an employments array, a pcs_orders array, and optional flags. Every field is optional unless noted: send only what your test needs, and leave the rest out.
Money and quantities are decimal strings, so nothing is lost to floating point: "2384.62", not 2384.62.

Examples

Each example is a request body for POST /v1/sandbox/scenarios/ and creates a new scenario. Send it with the same curl command as the first scenario. Every document_id is a library entry you uploaded first, and every name in filenames is an entry’s filename.

Two paystubs and a W-2

Name every file the user will upload. The scenario matches only when all three files are uploaded. It then serves one paystub per uploaded paystub, most recent first, and the W-2.

Contractor with a 1099-NEC

A 1099 goes in tax_documents with its subtype. The employment can carry no paystubs at all.

Volunteer hours log

Volunteer letters are matched to uploads by subtype, so upload a library entry whose documents declare VOLUNTEER_LETTER with subtype VOL_HOURS_LOG, then reference it.

Military PCS order

PCS orders sit at the top level of the payload. No employment is created for them, so an upload of only PCS orders returns the parsed orders and nothing else.

Documents that disagree on the name

A second employment whose full name differs ends the task with config_error, the way Truv’s “different applicant names” test files do.

Tampered document

flags.is_fraudulent marks the documents fraudulent and ends the task with config_error. The payload still needs the record the file would have yielded.

Nothing readable

A failure status needs no payload. no_data is how an upload Truv can’t read anything from ends. The library refuses an unreadable file, so upload any valid PDF as acme.blank.pdf; the scenario, not the file, produces the outcome.

Limits

These are the default limits for document upload payloads. The account-wide limits are listed on Custom Sandbox Data.

Next steps

Test Documents

Truv’s built-in test files and the filename rules behind them

Document Processing

The Document Collections API your library entries stand in for

Payroll scenarios

Serve the same employment data from a payroll login

Sandbox API reference

Full request and response schemas for every sandbox endpoint