Add 'Specification'

Skylar Ittner 2023-11-25 23:46:36 -07:00
commit 7f32213c86

65
Specification.md Normal file

@ -0,0 +1,65 @@
## Basic Rules
* The barcode shall be in QR Code, DataMatrix, or PDF417 format.
* Data fields shall be delineated with a pipe character (`|`).
* Data shall be encoded as ASCII or UTF-8. If the chosen barcode format has a different default/preferred encoding, that encoding may be used instead.
* Data fields shall not include a pipe character or newline.
* The data must not start or end with a pipe character.
* Most fields are not strictly required and may be left empty when not needed. Implementations may reject a code with insufficient data.
## Data Header
All barcodes shall start with `QSv1` as the first field. The second field shall specify the subtype of the barcode.
### Subtypes
* `tofrom`: Destination and return addresses only.
* `full`: Same as `tofrom` but with additional fields for the package's characteristics and requested extra services.
## Data Fields
### `tofrom`
Position | Meaning
0 | Format header (`QSv1`)
1 | Type header (`tofrom`)
2 | Sender/payer account number (vendor/implementation specific)
3 | To name
4 | To company/firm/business
5 | To street
6 | To secondary address line
7 | To city
8 | To state/province/etc
9 | To postal code
10 | To country (ISO 2-character country code)
11 | To phone
12 | To email
13 | From name
14 | From company/firm/business
15 | From street
16 | From secondary address line
17 | From city
18 | From state
19 | From postal code
20 | From country (ISO 2-character country code)
21 | From phone
22 | From email
### `full`
Position | Meaning
0 - 22 | See `tofrom`
23 | Weight (U.S. ounces)
24 | Item type (see appendix)
25 | Length (inches)
26 | Width (inches)
27 | Height (inches)
28 | Non-machinable: `1` if true, otherwise empty
29 | Certified Mail: `1` if true, otherwise empty
30 | Registered Mail: `1` if true, otherwise empty
31 | Registered Mail declared value, USD
32 | Return Receipt Requested: `1` if true, otherwise empty
33 | Special rate eligibility: `M` for Media Mail, `L` for Library Mail, empty if not claiming eligibility
34 | Insurance amount, USD
35 | Signature services. 1: Signature required, 2: Adult signature required, 3: Restricted delivery signature, 4: Adult restricted signature, 5: Indirect signature.