Stylograph API

Sending a note

Recipients, formats, handwriting, covers, QR codes and dry runs.

POST /api/v1/notes sends one note. It needs the notes:send scope and an Idempotency-Key header.

The body needs a format, a message and exactly one of recipient_id and recipient. Unknown fields are refused, so a typo in a field name answers 400 instead of being ignored.

The recipient

Send recipient_id for someone already in your address book. To find one, search by name or company:

curl "https://composer.stylograph.ai/api/v1/recipients?q=Ada%20Lovelace" \
  -H "Authorization: Bearer $STYLOGRAPH_API_KEY"

Every word of q must appear in the first name, last name or company, without case. A match shows the names, company, city and state, never the street lines or ZIP. limit runs from 1 to 50, and the default is 20. The search needs the notes:send scope, the scope that can already send to anyone in the address book. Archived recipients are left out.

Send recipient for someone new. It needs the recipients:write scope.

{
  "recipient": {
    "first_name": "Ada",
    "last_name": "Lovelace",
    "company": "Analytical Engines",
    "address_line1": "12 St James's Square",
    "city": "Boston",
    "state": "MA",
    "zip": "02108"
  }
}

If your address book already has someone with the same name and address, ignoring case, the note goes to that entry. Otherwise the person is added once the send passes every check, so a refused send never leaves a half-made entry behind. company is written on the envelope under the name.

To add people without sending them anything, or to load a whole list, see Recipients.

The address check

Every send checks the address with USPS. The API is stricter than the Note Composer, because nobody is there to look at the card:

  • An address USPS doesn't confirm is refused with the verdict and a suggested address in details. There is no way to send anyway.
  • If the check can't run just now, the send answers 503 and you can try again.
  • An address the account already checked isn't checked again.

Format and message

formatWhat it isMessage limit
foldedA 5×7 folded notecard400 characters
postcardA 4×6 postcard180 characters
letterOne handwritten page on stationery, mailed flat in a 9×12 envelope2000 characters, and the design's own limit
flatA 4×6 flat card in an A6 envelope, the cover on the front and the message on the back300 characters

Letters and flat cards are turned on by Stylograph, letters for an account and flat cards for an organization. Ask support@stylograph.ai if you want either. Without it, a send or a dry run in that format answers 400 PRODUCT_UNAVAILABLE and charges nothing.

GET /api/v1/account lists each format with its cost in credits, its message limit and whether it is available. A format that is paused answers PRODUCT_UNAVAILABLE.

The message is counted as printed. Curly quotes, dashes and ellipses are made plain first, and an ellipsis prints as three periods. Every character must be one the handwriting can write. An emoji, or a letter that wasn't captured, is refused instead of printed blank.

Even under the limit, a long message may not fit the card at the handwriting's size. That send answers 422 MESSAGE_DOES_NOT_FIT and charges nothing.

Letters

  • A letter needs letter_design_id, the stationery it is written on. GET /api/v1/letter-designs lists the designs the account can use, each with its own max_chars. A design it can't use answers 422 LETTER_DESIGN_UNAVAILABLE.
  • Blank lines in the message separate paragraphs.
  • A letter takes no cover, no card back and no cta. For a QR code, send qr_url: an https link of up to 120 characters on a site Stylograph support listed for the account. Any other link answers 422 QR_URL_NOT_ALLOWED.
  • letters in GET /api/v1/account says what a letter still needs: whether letters are on, the handwriting, a captured signature, the return block on the envelope and how many designs the account can use.

Flat cards

  • A flat card has no inside, so it takes no card back and no verbal_cue.
  • It carries a QR code only where Stylograph has turned the flat card QR code on for the organization. Then the code prints on the front.
  • GET /api/v1/account lists flat only for an organization that has it.

Whose handwriting

A note is written in the handwriting of the key's member. GET /api/v1/writers lists the writers on the key's team whose handwriting is ready, with each one's id and handwriting_profile_id.

An Operator's key may send writer_id to write in a teammate's handwriting. The note is still paid by the organization and recorded as sent by the key's member. Any other key sees only its own member, with can_choose set to false, and a writer_id for someone else answers 403 WRITER_NOT_ALLOWED.

The closing

{
  "closing": { "salutation": "Warmly,", "signature": true }
}

With signature: true the note is signed with the captured signature. Otherwise name is written in the handwriting.

The cover

Every folded note, postcard and flat card has a cover, and a letter has none. Leave card_image_key out to use the account's default cover, which GET /api/v1/account shows as default_cover_key. To pick one, send a key from GET /api/v1/covers. For a key with notes:send, that list also holds your own uploads under uploaded_covers.

To upload a cover of your own, send it as a form to POST /api/v1/covers:

curl https://composer.stylograph.ai/api/v1/covers \
  -H "Authorization: Bearer $STYLOGRAPH_API_KEY" \
  -F "file=@my-cover.jpg"
  • It takes a PNG, JPEG or WebP of 4 MB or smaller, and needs the notes:send scope.
  • Photo metadata such as location is removed, and the image is screened before it is stored. An image the screening refuses answers 422 IMAGE_NOT_ALLOWED and is stored nowhere.
  • The answer's data.key is the card_image_key to send.
  • A team keeps at most 100 uploaded covers. Delete one in the Note Composer to free a slot.
  • Up to 30 images an hour are screened. Past that, an upload answers 429 IMAGE_SCREENING_RATE_LIMITED.

A QR code

Set cta and the note carries a QR code, with an optional line beside it in the handwriting. A letter uses qr_url instead (see Letters), and a flat card has its own rule (see Flat cards). There are two kinds.

A referral code opens the account's own referral link:

{
  "cta": { "type": "referral", "verbal_cue": "Scan to send some notes of your own, on me." }
}
  • Someone who scans it and signs up is credited to the account as its referral.
  • referral_qr_available in GET /api/v1/account says whether the account can carry one. Without a referral code, a send answers 409 REFERRAL_LINK_UNAVAILABLE.

A visit code opens a link of your own:

{
  "cta": { "type": "visit", "url": "https://www.example.com/welcome", "verbal_cue": "Scan for 10% off your next visit." }
}
  • The link must be https and on one of the account's QR code sites, which you add in the Note Composer under Settings, in QR code sites, or on one of Stylograph's own sites. A site that isn't listed answers 422 QR_SITE_NOT_LISTED, and one still waiting for review answers 422 QR_SITE_PENDING.
  • A link that passes the visitor on to another address answers 422 QR_LINK_REDIRECTS.
  • Every link is checked against Google's list of unsafe sites before the send. Nothing is charged when a link is refused.

For both kinds:

  • A scan goes through Stylograph's short link, and the note's cta.scans counts the scans.
  • The line is up to 100 characters on a folded note and 40 on a postcard. It doesn't count toward the message.
  • On a folded note with a card back, the QR code is printed inside the card.

The return address

The note carries the account's return address. A postcard may send return_address_on: false to leave it off.

Holding to one handwriting

GET /api/v1/account returns handwriting.profile_id. Pass it as handwriting_profile_id and the send is refused if the account's handwriting has changed since you read it.

Dry runs

dry_run: true runs every check a send runs and answers 200 with what it would send: the message as it will print, the cover, the card back, the credits and whether the recipient is new. It creates no note and no recipient, and charges nothing. A dry run needs no Idempotency-Key, but it counts toward the request and address check limits.

Idempotency

Every send needs an Idempotency-Key header of 1 to 255 visible ASCII characters, unique to the note across your team.

  • The same key with the same body answers 200 with the note it made and Idempotent-Replayed: true, and charges nothing.
  • The same key with a different body answers 422 IDEMPOTENCY_KEY_REUSED.
  • Keys never expire.

A client that can't set headers may send idempotency_key in the body instead. If both are sent, they must match.

Use a key your own system already has when there is one, such as an order number. Then a retry after a timeout can never send twice, and you can cancel the note by that same key while it is queued.

Duplicates

A send of the same message to the same recipient within 24 hours, from anyone on your team, is refused with 409 DUPLICATE_NOTE, and nothing is charged. details.reason is same_message. The guard is there for a caller with no person watching each send, such as an agent that loops and makes a new key each time. To mail a second copy on purpose, send allow_duplicate: true. A cancelled note never counts as a duplicate.

One note a day per CRM contact

When the note is for someone in your CRM, send crm_contact with the CRM's name and the contact's id there:

{
  "crm_contact": { "source": "hubspot", "id": "4512" }
}

Your team then mails at most one note a day to that contact, whichever app or integration sends it. The day is the one the note goes to print: scheduled_for, or the day it is sent. So a Zap and a CRM connector that fire on the same closing mail one card. A second send that day answers 409 DUPLICATE_NOTE with details.reason same_crm_contact_day, unless it sets allow_duplicate: true.

  • source is 1 to 40 lower-case letters, digits, dots, dashes or underscores, such as hubspot or followupboss.
  • id is the contact's id in that CRM, up to 100 characters with no spaces or colons.
  • Leave it out for anyone who isn't in a CRM. Two people at one address are then never mistaken for one.

Labelling the app that sent it

An app may send client, a short label such as zapier, with the same rules as crm_contact.source. It is kept on the note and returned as the note's client, so an app can tell its own notes apart, for example so a trigger on new notes doesn't fire on the notes it sent. It changes nothing about the send, and a retry with a different client still replays the note.

The content check

Every send is checked for its content. A note whose check flags something, or couldn't run, is held for a person at Stylograph to look at before it prints. It shows as queued while it waits. If it is turned down, it becomes failed with failure_code: content_rejected and its credits are refunded.

What a send charges

The format's credits are taken when the send is accepted. A note sent through the API that fails before it is printed is refunded once. See Note status.

On this page