GoliathDevelopersGet an API key
Reference/Contractsgenerated from the gateway manifest

previewContract

The filled PDF a contract would be.

POST/api/v1/callWRITEidempotent · 24 hruns as the key's owner
View as Markdown

The filled PDF a contract would be (pdfUrl, short-lived) and any values that overflow their box or cannot print. Takes what prepareContract takes as input.contract. Nothing is saved.

curl https://server.goliathdata.com/api/v1/call \
  -H "Authorization: Bearer $GOLIATH_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "operationId": "previewContract",
    "variables": {
      "input": {
        "templateId": "<templateId>",
        "templateVersionId": "<templateVersionId>",
        "contactId": "<contactId>",
        "title": "<String>",
        "values": [
          {
            "key": "<key>",
            "value": "<String>"
          }
        ],
        "recipients": [
          {
            "roleKey": "<roleKey>",
            "displayName": "<String>"
          }
        ],
        "subject": "<String>",
        "message": "<String>",
        "expiryDays": 10
      }
    }
  }'
import { GoliathClient } from '@goliath-data/sdk'

const goliath = new GoliathClient({
  apiKey: process.env.GOLIATH_API_KEY!,
  baseUrl: 'https://server.goliathdata.com',
})

const result = await goliath.contracts.previewContract(
  {
    input: {
      templateId: '<templateId>',
      templateVersionId: '<templateVersionId>',
      contactId: '<contactId>',
      title: '<String>',
      values: [
        {
          key: '<key>',
          value: '<String>'
        }
      ],
      recipients: [
        {
          roleKey: '<roleKey>',
          displayName: '<String>'
        }
      ],
      subject: '<String>',
      message: '<String>',
      expiryDays: 10
    }
  },
  { idempotencyKey: crypto.randomUUID() },
)
const res = await fetch('https://server.goliathdata.com/api/v1/call', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.GOLIATH_API_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': crypto.randomUUID(),
  },
  body: JSON.stringify({
    operationId: 'previewContract',
    variables: {
      input: {
        templateId: '<templateId>',
        templateVersionId: '<templateVersionId>',
        contactId: '<contactId>',
        title: '<String>',
        values: [
          {
            key: '<key>',
            value: '<String>'
          }
        ],
        recipients: [
          {
            roleKey: '<roleKey>',
            displayName: '<String>'
          }
        ],
        subject: '<String>',
        message: '<String>',
        expiryDays: 10
      }
    }
  }),
})
const { data, errors } = await res.json()

Variables

The example sends only what the schema requires. Some operations also need one of several optional variables (one filter or another, say); the description above says which.

inputAdminContractSendInput!required

A contract as the sender has it on the prepare screen.

templateIdID!required
templateVersionIdID!required

The published version the screen was opened on; a newer publish refuses the prepare.

contactIdID!required
pipelineItemIdID
dealIdID
titleString!required
values[AdminContractSendValueInput!]!required

The sender's value per prefill; a prefill left out keeps what the CRM filled.

recipients[AdminContractSendRecipientInput!]!required
subjectString!required
messageString!required
expiryDaysInt!required

Days signers have once it is sent, 1-90.

expiresOnString

The day the links stop working, YYYY-MM-DD, through its end in the contract's time zone; left out, expiryDays from the send.

noteInTextBoolean

The note opens the invitation texts too, as the send screen's note field says; left out, the note is for the email alone (workflows, the API).

reminderIntervalDaysInt

Days between automatic reminders, 1-30; left out, every day; null turns them off.

afterSigningContractAfterSigningInput

This send's After signing button. Left out: the template's; null: none on this send.

salesOfferIdID

The Goliath sales offer this send carries (a Goliath plan template's, created by a Goliath admin from the Plan sheet).

Every field, all the way down
variables
[
  {
    "name": "input",
    "type": "AdminContractSendInput!",
    "required": true,
    "description": "A contract as the sender has it on the prepare screen.",
    "defaultValue": null,
    "fields": [
      {
        "name": "templateId",
        "type": "ID!",
        "required": true,
        "description": null,
        "defaultValue": null
      },
      {
        "name": "templateVersionId",
        "type": "ID!",
        "required": true,
        "description": "The published version the screen was opened on; a newer publish refuses the prepare.",
        "defaultValue": null
      },
      {
        "name": "contactId",
        "type": "ID!",
        "required": true,
        "description": null,
        "defaultValue": null
      },
      {
        "name": "pipelineItemId",
        "type": "ID",
        "required": false,
        "description": null,
        "defaultValue": null
      },
      {
        "name": "dealId",
        "type": "ID",
        "required": false,
        "description": null,
        "defaultValue": null
      },
      {
        "name": "title",
        "type": "String!",
        "required": true,
        "description": null,
        "defaultValue": null
      },
      {
        "name": "values",
        "type": "[AdminContractSendValueInput!]!",
        "required": true,
        "description": "The sender's value per prefill; a prefill left out keeps what the CRM filled.",
        "defaultValue": null,
        "fields": [
          {
            "name": "key",
            "type": "ID!",
            "required": true,
            "description": "The prefill's key.",
            "defaultValue": null
          },
          {
            "name": "value",
            "type": "String!",
            "required": true,
            "description": null,
            "defaultValue": null
          },
          {
            "name": "type",
            "type": "AdminContractValueType",
            "required": false,
            "description": "The value's type on this send, when the sender changed it; left out keeps the template's.",
            "defaultValue": null,
            "enumValues": [
              "TEXT",
              "DATE",
              "MONEY",
              "NUMBER",
              "BOOLEAN"
            ]
          }
        ]
      },
      {
        "name": "recipients",
        "type": "[AdminContractSendRecipientInput!]!",
        "required": true,
        "description": null,
        "defaultValue": null,
        "fields": [
          {
            "name": "roleKey",
            "type": "ID!",
            "required": true,
            "description": null,
            "defaultValue": null
          },
          {
            "name": "displayName",
            "type": "String!",
            "required": true,
            "description": null,
            "defaultValue": null
          },
          {
            "name": "email",
            "type": "String",
            "required": false,
            "description": "Their email when they are sent it by Email; give exactly one of an email or a phone.",
            "defaultValue": null
          },
          {
            "name": "phone",
            "type": "String",
            "required": false,
            "description": "Their mobile number when they are sent it by Text, in any US form; give exactly one of an email or a phone.",
            "defaultValue": null
          },
          {
            "name": "contactId",
            "type": "ID",
            "required": false,
            "description": "The contact this recipient is, when they are one.",
            "defaultValue": null
          },
          {
            "name": "signingOrder",
            "type": "Int",
            "required": false,
            "description": "The signer's turn, 1-based; signers sharing a turn sign at once. Null on a copy; null on every recipient keeps the template's order.",
            "defaultValue": null
          }
        ]
      },
      {
        "name": "subject",
        "type": "String!",
        "required": true,
        "description": null,
        "defaultValue": null
      },
      {
        "name": "message",
        "type": "String!",
        "required": true,
        "description": null,
        "defaultValue": null
      },
      {
        "name": "expiryDays",
        "type": "Int!",
        "required": true,
        "description": "Days signers have once it is sent, 1-90.",
        "defaultValue": null
      },
      {
        "name": "expiresOn",
        "type": "String",
        "required": false,
        "description": "The day the links stop working, YYYY-MM-DD, through its end in the contract's time zone; left out, expiryDays from the send.",
        "defaultValue": null
      },
      {
        "name": "noteInText",
        "type": "Boolean",
        "required": false,
        "description": "The note opens the invitation texts too, as the send screen's note field says; left out, the note is for the email alone (workflows, the API).",
        "defaultValue": null
      },
      {
        "name": "reminderIntervalDays",
        "type": "Int",
        "required": false,
        "description": "Days between automatic reminders, 1-30; left out, every day; null turns them off.",
        "defaultValue": null
      },
      {
        "name": "afterSigning",
        "type": "ContractAfterSigningInput",
        "required": false,
        "description": "This send's After signing button. Left out: the template's; null: none on this send.",
        "defaultValue": null,
        "fields": [
          {
            "name": "label",
            "type": "String!",
            "required": true,
            "description": null,
            "defaultValue": null
          },
          {
            "name": "url",
            "type": "String!",
            "required": true,
            "description": null,
            "defaultValue": null
          },
          {
            "name": "caption",
            "type": "String",
            "required": false,
            "description": null,
            "defaultValue": null
          },
          {
            "name": "icon",
            "type": "ContractAfterSigningIcon!",
            "required": true,
            "description": "The mark beside the After signing button's label. GOLIATH: Goliath's own mark, with a trailing arrow.",
            "defaultValue": null,
            "enumValues": [
              "GOLIATH",
              "ARROW_RIGHT",
              "CALENDAR",
              "NONE"
            ]
          },
          {
            "name": "style",
            "type": "ContractAfterSigningStyle!",
            "required": true,
            "description": "How the After signing button is painted. DARK: The app's dark button. LIGHT: White with an outline. BRAND: Filled with the template owner's own color.",
            "defaultValue": null,
            "enumValues": [
              "DARK",
              "LIGHT",
              "BRAND"
            ]
          },
          {
            "name": "color",
            "type": "String",
            "required": false,
            "description": null,
            "defaultValue": null
          },
          {
            "name": "autoContinue",
            "type": "Boolean!",
            "required": true,
            "description": null,
            "defaultValue": null
          }
        ]
      },
      {
        "name": "salesOfferId",
        "type": "ID",
        "required": false,
        "description": "The Goliath sales offer this send carries (a Goliath plan template's, created by a Goliath admin from the Plan sheet).",
        "defaultValue": null
      }
    ]
  }
]

Response

What comes back under data: a list shows as one entry, and a value as its type.

response shape
{
  "data": {
    "contractsMutation": {
      "previewContract": {
        "pdfUrl": "…",
        "overflowing": [
          "…"
        ],
        "unprintable": [
          "…"
        ]
      }
    }
  }
}

Errors

Idempotency

Send an Idempotency-Key of 1 to 255 characters. A finished request retried with the same key replays its stored response, marked Idempotency-Replayed: true; one still in flight returns 409 idempotency_conflict. Keys expire after 24 hours. Write without fear →