Unitpost Contact fields API

Define the typed custom attributes (text, number, date, …) your contacts carry — usable in templates as per-recipient variables.

GitHub OpenAPI

Operations 6

GET /contact-fields List custom contact fields #
POST /contact-fields Create a custom contact field #
GET /contact-fields/{id} Retrieve a custom contact field #
PATCH /contact-fields/{id} Update a custom contact field #
DELETE /contact-fields/{id} Delete a custom contact field #
POST /contact-fields/{id}/rename Rename a custom field's key #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/unitpost-com:unitpost-com-contact-fields-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

unitpost-com-contact-fields-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Unitpost Contact fields API
  version: v1
  description: 'Public, versioned API for sending email and SMS and managing contacts, segments, campaigns, templates, domains, and webhooks. SMS is included on paid plans; on the free plan `POST /sms` returns `403` with `limit_reached`. Authenticate every request with an API key: `Authorization: Bearer `. A `User-Agent` header is required. Requests are scoped to the workspace that owns the key and are rate-limited per workspace. List endpoints are cursor-paginated via `limit`/`after`/`before` and return a `{ object: "list", has_more, data }` envelope. Register webhook endpoints to receive events: each create returns a `signing_secret` (`whsec_…`) exactly once. Every delivery is **svix-compatible**: it carries `svix-id`, `svix-timestamp`, and `svix-signature` (`v1,`) headers computed over `..` with your secret — verify them and reject deliveries whose signature doesn''t match (any Svix-compatible library works). Inbound email that lands on a receiving-enabled domain is readable under `/email/received`.'
servers:
- url: https://www.unitpost.com/api/v1
  description: Base URL
security:
- apiKey: []
tags:
- name: Contact fields
  description: Define the typed custom attributes (text, number, date, …) your contacts carry — usable in templates as per-recipient variables.
paths:
  /contact-fields:
    get:
      operationId: contact_fields_list
      tags:
      - Contact fields
      summary: List custom contact fields
      description: Retrieve a list of the custom contact fields defined in your workspace, cursor-paginated. These are the typed attributes (text, number, date, boolean, and so on) you can set on any contact and reference as template variables. Define a new one with Create a custom contact field. Requires the `contacts:read` capability.
      parameters:
      - name: limit
        in: query
        required: false
        description: Max rows to return (default 20, max 100).
        schema:
          type: integer
          minimum: 1
          maximum: 100
      - name: after
        in: query
        required: false
        description: Return rows after this id (forward paging).
        schema:
          type: string
      - name: before
        in: query
        required: false
        description: Return rows before this id (backward paging).
        schema:
          type: string
      responses:
        '200':
          description: A page of contact fields.
          content:
            application/json:
              schema:
                type: object
                properties:
                  object:
                    type: string
                    enum:
                    - list
                  has_more:
                    type: boolean
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/ContactField'
                required:
                - object
                - has_more
                - data
          headers:
            Unitpost-Warning:
              $ref: '#/components/headers/UnitpostWarning'
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Invalid pagination params.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    post:
      operationId: contact_fields_create
      tags:
      - Contact fields
      summary: Create a custom contact field
      description: 'Define a new typed custom field that can then be set on any contact and used as a template variable (e.g. `plan`, `signup_date`). An optional `default_value` is the value used for any contact that has none: when an email is sent (merge tags) and when segments are evaluated. It''s never written onto contacts, so changing it takes effect everywhere at once. The `key` and `type` are fixed once created — rename the key later with Rename a custom field''s key, or change the label with Update a custom contact field. See existing fields via List custom contact fields. Requires the `contacts:write` capability.'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContactFieldCreate'
      responses:
        '201':
          description: Created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactField'
          headers:
            Unitpost-Warning:
              $ref: '#/components/headers/UnitpostWarning'
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: A field with that key already exists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /contact-fields/{id}:
    parameters:
    - name: id
      in: path
      required: true
      schema:
        type: string
    get:
      operationId: contact_fields_get
      tags:
      - Contact fields
      summary: Retrieve a custom contact field
      description: Retrieve a single custom contact field by `id`, including its key, type, and label. Update its label with Update a custom contact field, or rename the key with Rename a custom field's key. Requires the `contacts:read` capability.
      responses:
        '200':
          description: The contact field.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactField'
          headers:
            Unitpost-Warning:
              $ref: '#/components/headers/UnitpostWarning'
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Contact field not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    patch:
      operationId: contact_fields_update
      tags:
      - Contact fields
      summary: Update a custom contact field
      description: Update a custom field's editable metadata, such as its display label or `default_value`. A changed default takes effect at once, for sends and for segment membership, because it is never stored on contacts. The `key` and `type` are immutable here — to change the key (and migrate every contact's stored value) use Rename a custom field's key instead. Requires the `contacts:write` capability.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContactFieldUpdate'
      responses:
        '200':
          description: The updated contact field.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactField'
          headers:
            Unitpost-Warning:
              $ref: '#/components/headers/UnitpostWarning'
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Contact field not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    delete:
      operationId: contact_fields_delete
      tags:
      - Contact fields
      summary: Delete a custom contact field
      description: Permanently delete a custom field definition and strip its stored value from every contact. Any template variable that referenced it will resolve to empty. On more than 5,000 contacts the strip runs as a background job and the response is `202` with the job's progress instead of `204`. This can't be undone — recreate the field with Create a custom contact field if you need it back. Requires the `contacts:write` capability.
      responses:
        '202':
          description: 'Accepted: the field held a value on more than 5,000 contacts, so the strip runs as a background job. The field is already gone from lists; `GET /contact-fields/{id}` answers 404 once the job''s final step removed it. The body is the job; follow it with `GET /jobs/{id}` until its `status` is `COMPLETED` (or `FAILED`).'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Job'
          headers:
            Unitpost-Warning:
              $ref: '#/components/headers/UnitpostWarning'
        '204':
          description: Deleted.
          headers:
            Unitpost-Warning:
              $ref: '#/components/headers/UnitpostWarning'
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Contact field not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: 'Refused: a dynamic segment still filters on the key, the workspace is protected, or a delete, rename or bulk set (`POST /contacts/set-field`) of this field is already running (`job_in_progress`; the `Location` header names that job).'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /contact-fields/{id}/rename:
    parameters:
    - name: id
      in: path
      required: true
      schema:
        type: string
    post:
      operationId: contact_fields_rename
      tags:
      - Contact fields
      summary: Rename a custom field's key
      description: Change a custom field's `key`, migrating the stored value on every contact so no data is lost. Because the key is how templates and the API reference the field, update any template variables that used the old key. To change only the display label, use Update a custom contact field. Requires the `contacts:write` capability.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContactFieldRename'
      responses:
        '200':
          description: The renamed contact field.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactField'
          headers:
            Unitpost-Warning:
              $ref: '#/components/headers/UnitpostWarning'
        '202':
          description: 'Accepted: the field held a value on more than 5,000 contacts. The field already carries the new key (`GET /contact-fields/{id}` shows it); each contact''s stored value moves to the new key in the background. A value written under the new key while the job runs is kept; until the job reaches a contact, that contact resolves the new key to the field''s default. The body is the job; follow it with `GET /jobs/{id}` until its `status` is `COMPLETED` (or `FAILED`).'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Job'
          headers:
            Unitpost-Warning:
              $ref: '#/components/headers/UnitpostWarning'
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Contact field not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: A field with the new key already exists, or a delete, rename or bulk set (`POST /contacts/set-field`) of this field is already running (`job_in_progress`; the `Location` header names that job).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Job:
      type: object
      properties:
        object:
          type: string
          const: job
        id:
          type: string
        kind:
          type: string
        status:
          type: string
          enum:
          - QUEUED
          - RUNNING
          - COMPLETED
          - FAILED
          - CANCELED
        total:
          anyOf:
          - type: integer
            minimum: -9007199254740991
            maximum: 9007199254740991
          - type: 'null'
        processed:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        failed:
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        error:
          anyOf:
          - type: string
          - type: 'null'
        created_at:
          type: string
        completed_at:
          anyOf:
          - type: string
          - type: 'null'
      required:
      - object
      - id
      - kind
      - status
      - total
      - processed
      - failed
      - error
      - created_at
      - completed_at
    ContactFieldRename:
      type: object
      properties:
        key:
          type: string
      required:
      - key
    ContactFieldCreate:
      type: object
      properties:
        key:
          type: string
        label:
          type: string
        type:
          type: string
          enum:
          - text
          - number
          - boolean
          - date
        default_value:
          description: 'The value used for any contact that has none for this field (key missing or null): when an email is sent (merge tags) and when segments are evaluated. It''s never written onto contacts, so changing it takes effect everywhere at once. Stored as a string and coerced to the field''s type; null means no default. In segment filters, is_set / is_not_set check whether the contact itself has a value.'
          anyOf:
          - type: string
          - type: 'null'
      required:
      - key
      - label
    ContactField:
      type: object
      properties:
        object:
          type: string
          const: contact_field
        id:
          type: string
        key:
          type: string
        label:
          type: string
        type:
          type: string
          enum:
          - text
          - number
          - boolean
          - date
        default_value:
          description: 'The value used for any contact that has none for this field (key missing or null): when an email is sent (merge tags) and when segments are evaluated. It''s never written onto contacts, so changing it takes effect everywhere at once. Stored as a string and coerced to the field''s type; null means no default. In segment filters, is_set / is_not_set check whether the contact itself has a value.'
          anyOf:
          - type: string
          - type: 'null'
        position:
          type: number
        created_at:
          type: string
        updated_at:
          type: string
      required:
      - object
      - id
      - key
      - label
      - type
      - default_value
      - position
      - created_at
      - updated_at
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Stable machine-readable error code (branch on this, not the message).
            message:
              type: string
              description: 'Human-readable summary. For validation errors it''s path-prefixed (e.g. "template.variables.first_name: …").'
            details:
              type: array
              description: 'Present on errors that carry per-field reasons: validation errors (422), a blocked campaign send (409), a plan that doesn''t include a feature (403 `limit_reached` with one entry whose `code` is `feature_not_in_plan` and whose `field` names the feature, e.g. `smsChannel`), and a send cap (429 `quota_exceeded` with one entry, `field` empty, whose `code` says which cap: `daily_quota_exceeded` or `monthly_quota_exceeded` (the free plan''s daily or monthly cap), `plan_required` (the workspace needs a paid plan to send this), `allowance_used` (a paid plan''s allowance is spent and it has no pay-as-you-go), `shared_plan_cap` (the organization''s shared plan, or this workspace''s cap on it, is used up) or `risk_throttled` (the account review''s daily cap, which an upgrade doesn''t lift)). One entry per offending field/blocker.'
              items:
                type: object
                properties:
                  field:
                    type: string
                    description: Dotted path to the field, e.g. "template.variables.first_name" (empty for a whole-body problem).
                  code:
                    type: string
                    description: Machine-readable reason for this entry, when there is one (e.g. `template_not_published` on `template_id` for a blocked SMS campaign send, or `feature_not_in_plan` on `smsChannel` when the plan has no SMS). Absent on plain validation errors.
                  message:
                    type: string
                required:
                - field
                - message
            doc_url:
              type: string
              format: uri
              description: 'A page that explains this error and what to do, when there is one: an absolute link on the API''s own host. Every 429 has one (a section of the rate-limits guide: the request limit, an operation''s limit, the plan''s send caps or the account review cap), as do `sending_paused`, the SMS access review''s `sms_review_pending` and `account_under_review`, and errors about domains, API keys, idempotency keys, plan limits, billing, SMS consent and suppression. A `details[].code` with a page of its own picks it. Additive; absent otherwise.'
          required:
          - code
          - message
      required:
      - error
    ContactFieldUpdate:
      type: object
      properties:
        label:
          type: string
        type:
          type: string
          enum:
          - text
          - number
          - boolean
          - date
        position:
          type: integer
          minimum: 0
          maximum: 9007199254740991
        default_value:
          description: 'The value used for any contact that has none for this field (key missing or null): when an email is sent (merge tags) and when segments are evaluated. It''s never written onto contacts, so changing it takes effect everywhere at once. Stored as a string and coerced to the field''s type; null means no default. In segment filters, is_set / is_not_set check whether the contact itself has a value.'
          anyOf:
          - type: string
          - type: 'null'
  headers:
    UnitpostWarning:
      description: 'Present when the request carried something this operation ignored (an unknown body key, a filter value it can''t apply, a recipient on a reserved domain it left out, …): one sentence per item, at most 1 KB in all (notes past that are counted, and a long list of addresses names the first ones and how many in all). The answer is the one without it. Send `Unitpost-Strict: true` to have such a request refused with a `422` instead; on `POST /email/batch` a reserved recipient refuses only its item, which comes back in `failed` while the rest of the batch is sent.'
      schema:
        type: string
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: Your workspace API key.