Ontraport Objects API

Generic CRUD operations across Ontraport object types.

OpenAPI Specification

ontraport-objects-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Ontraport REST Metadata Objects API
  description: 'Ontraport''s REST API exposes CRUD access to contacts, transactions, tags,

    sequences, forms, landing pages, and ecommerce objects. Authentication uses

    `Api-Key` and `Api-Appid` HTTP headers. All endpoints share a generic object

    interface where the object type is specified via parameters.

    '
  version: 1.0.0
  contact:
    name: Ontraport Developer Documentation
    url: https://api.ontraport.com/doc/
servers:
- url: https://api.ontraport.com/1
  description: Ontraport REST API v1
security:
- ApiKeyAuth: []
  AppIdAuth: []
tags:
- name: Objects
  description: Generic CRUD operations across Ontraport object types.
paths:
  /objects:
    get:
      tags:
      - Objects
      summary: List objects
      description: Retrieves a collection of objects based on a set of parameters.
      parameters:
      - $ref: '#/components/parameters/ObjectTypeId'
      - name: start
        in: query
        schema:
          type: integer
      - name: range
        in: query
        schema:
          type: integer
      responses:
        '200':
          $ref: '#/components/responses/ObjectsResponse'
    post:
      tags:
      - Objects
      summary: Create object
      description: Adds new data to your database.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ObjectInput'
      responses:
        '200':
          $ref: '#/components/responses/ObjectResponse'
    put:
      tags:
      - Objects
      summary: Update object
      description: Updates existing object data.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ObjectInput'
      responses:
        '200':
          $ref: '#/components/responses/ObjectResponse'
    delete:
      tags:
      - Objects
      summary: Delete object(s)
      description: Permanently removes data from the database.
      parameters:
      - $ref: '#/components/parameters/ObjectTypeId'
      - name: id
        in: query
        schema:
          type: integer
      responses:
        '200':
          $ref: '#/components/responses/SimpleResponse'
  /object:
    get:
      tags:
      - Objects
      summary: Retrieve a single object by ID
      parameters:
      - $ref: '#/components/parameters/ObjectTypeId'
      - name: id
        in: query
        required: true
        schema:
          type: integer
      responses:
        '200':
          $ref: '#/components/responses/ObjectResponse'
  /objects/saveorupdate:
    post:
      tags:
      - Objects
      summary: Save or update object
      description: Creates a new object or merges with an existing one if a unique field matches.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ObjectInput'
      responses:
        '200':
          $ref: '#/components/responses/ObjectResponse'
  /objects/tag:
    get:
      tags:
      - Objects
      summary: Retrieve objects by tag
      parameters:
      - $ref: '#/components/parameters/ObjectTypeId'
      - name: tag_id
        in: query
        schema:
          type: integer
      responses:
        '200':
          $ref: '#/components/responses/ObjectsResponse'
  /object/getByEmail:
    get:
      tags:
      - Objects
      summary: Retrieve object ID by email
      parameters:
      - $ref: '#/components/parameters/ObjectTypeId'
      - name: email
        in: query
        required: true
        schema:
          type: string
          format: email
      responses:
        '200':
          $ref: '#/components/responses/SimpleResponse'
components:
  parameters:
    ObjectTypeId:
      name: objectID
      in: query
      required: true
      description: Numeric Ontraport object type ID (e.g. 0 = Contacts).
      schema:
        type: integer
  schemas:
    ObjectsListResponse:
      type: object
      additionalProperties: true
      properties:
        code:
          type: integer
        data:
          type: array
          items:
            type: object
            additionalProperties: true
    ObjectInput:
      type: object
      additionalProperties: true
      properties:
        objectID:
          type: integer
        email:
          type: string
          format: email
        firstname:
          type: string
        lastname:
          type: string
    ObjectResponse:
      type: object
      additionalProperties: true
      properties:
        code:
          type: integer
        data:
          type: object
          additionalProperties: true
  responses:
    ObjectsResponse:
      description: Collection of objects response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ObjectsListResponse'
    ObjectResponse:
      description: Single object response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ObjectResponse'
    SimpleResponse:
      description: Generic response
      content:
        application/json:
          schema:
            type: object
            additionalProperties: true
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Api-Key
    AppIdAuth:
      type: apiKey
      in: header
      name: Api-Appid