Total Expert Lead Opportunities (New) API

The Lead Opportunities (New) API from Total Expert — 2 operation(s) for lead opportunities (new).

OpenAPI Specification

total-expert-lead-opportunities-new-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Total Expert Public Account Endpoints Lead Opportunities (New) API
  version: v1
  description: "The Total Expert REST API allows you to programmatically create, retrieve, update, and delete information through various endpoints.\n\nDocumentation Layout\n\nEach section of this documentation describes a collection of related endpoints that affect a given resource.\n\nWhere applicable, at the top of a section you will find a table listing the attributes for the resource and a second showing its relationships with other resources.\n\nNOTE: If an attribute is marked as 'Assignable', its value can be set via a POST/PATCH. You can also modify the data for an 'Assignable' relationship.\n\nAuthentication in the TE API\n\nInteraction with the TE API is protected with OAuth 2.0. A client ID/secret pair is required to use the API.\n\nThe ID/secret pair is used to request an access token from the '/token' endpoint. This token will need to be present within the header on all calls to the API.\n\nNOTE: See the 'Authentication' endpoint collection for more information. See the 'Heartbeats' endpoint collection for more information on how to test your authentication.\n\nEndpoint Standards\n\nEach endpoint provides interaction with two aspects of an entity:\n\n'Attributes' - Attributes of the entity itself. Includes things like first name, phone number, or birthday of the contact.\nE.g. A 'Contact'\n\n'Relationships' - Describe a relationship between that entity and another entity.\nE.g. A contact that has an owner in the TE System OR a set of contact groups (separate entities with their own endpoint).\n\nAttributes\n\nEach endpoint returns a JSON object with a set of attributes. Each endpoint collection should describe the names and types of attributes available in each endpoint.\n\nData Types\n\nEach attribute has a type. There are four data types in the TE API - Numeric, String, Boolean, and Date.\n\nData Types\n\nType\nDescription\n\nNumeric\nInteger or floating point numbers. Supplied with no surrounding quotes. e.g. { \"loan_rate\":4.5 }\n\nString\nString of characters - supplied surrounded with quotes. e.g. { \"first_name\":\"Clark\" }\n\nBoolean\nTruth value - supplied in one of two ways - see Boolean (String) and Boolean (Numeric) for details\n\nBoolean (String)\nTruth value - supplied as the word \"True\" or \"False\", surrounded by quotes. e.g. { \"first_time_buyer\":\"True\" }\n\nBoolean (Numeric)\nTruth value - supplied as the number 1 or 0, not surrounded by quotes. e.g. { \"first_time_buyer\":0 }\n\nDate\nA date and time - preferred supplied in the format \"YYYY-MM-DD hh:mm:ss\". All dates must be provided in UTC timezone. When returned, the value will be expressed in UTC. To clear a field with a date type, use the value \"0000-00-00 00:00:00\".\n\nPhone Numbers\n\nPhone numbers are accepted in any format. For deduplication, any non-numeric symbols will be stripped out and the numeric phone number will be stored separately. If a numerically identical phone number is used in a different format later, the records are compared using the numeric value only. This applies only to phone numbers with at least 7 digits.\n\nAll phone numbers will also be converted into E164 for use in external services (e.g. Twilio). If a phone number cannot be converted into E164, the number will be marked 'Invalid', and external services that rely on phone numbers will not function.\n\nUniqueness in the TE API\n\nEach type of entity in the TE API can be uniquely identified by a set of attributes. In some cases, multiple options are available to uniquely identify an entity. See each section below for details. These sets of attributes are used to deduplicate entries on creation and to uniquely identify the target in a relationship.\n\nRelationships\n\nRelationships in the TE API are very flexible.\n\n'GET'ing\n\nWhen GETing an entity, a relationship will be returned with only a partial set of attributes that make sense in the context of that endpoint - e.g. the 'contact_groups' relationship on the '/contacts' endpoint will display only the group name of the target contact_group.\n\nPOST and PATCH Requests\n\nWhen setting a relationship (by POST or PATCH), the target entity is specified using one or more attributes that uniquely identify the entity.\n\nThe allowed attributes are listed in the 'Settable Fields' column of each Relationships table. For example, when POSTing to the '/contact-groups' endpoint, either of the following are allowed:\n\n{\n  \"group_name\": \"Hot Leads\",\n  \"owner\":{\"username\": \"alfred\"}\n  }\n  OR\n\n{\n  \"group_name\": \"Hot Leads\",\n  \"owner\":{\"id\": \"123589\"}\n  }\n\nIn cases where an endpoint's relationship supports multiple Settable Fields be aware that the request examples may only make use of one of the attributes though any could be used in its place.\n\nInteracting with the API\n\nAdmin Calls vs User Calls\n\nYou'll notice that many sections of the documentation have samples for POSTs and GETs that are labeled \"As Admin\" or \"As User\".\nWhen using client credentials to access the API, you'll use the \"As Admin\" examples. For Authorization Code access, you'll use the \"As User\" examples.\n\n'GET'ing\n\nThere are two types of GETable endpoints in the TE API: Paging and Individual. Paging endpoints provide lists of entities. E.g. '/contacts' returns a list of contacts.\n\nGetting Individual Entities\n\nIndividual endpoints return specific individual entities, specified by TE ID. E.g. '/contacts/51151' returns the contact with the 'id' attribute '51151' (the TE internal identifier).\n\nGetting Multiple Entities (Paging)\n\nPaging endpoints will return an object with two properties: 'objects' and 'links'. The 'objects' property will be an array of entities in 'pages'. Each page will have a number of entities along with a set of links. The page size and page number can be specified using the '?page' GET parameter. Setting '?page[number]=5' will return the fifth page. Setting '?page[size]=100' will make each page consist of 100 items, instead of the default of 10. Both attributes can be set together. E.g. setting '?page[size]=100&page[number]=6' will return items 501-600.\n\nPaging Links\n\nThe 'links' attribute on a page object will have four attributes, specifying metadata about the number of entities available to page.\n\n'first' will be the page number of the first page of entities (always '1').\n\n'last' will be the page number of the last page of entities.\n\n'next' will be the page number of the next page after the currently requested one. 'next' may be null if there are no subsequent pages.\n\n'prev' will be the page number of the page immediately preceding the current one. 'prev' may be null if there are no preceding pages.\n\n'POST'ing\n\nEntities can be created in the TE system by POSTing to paging endpoints. E.g. sending a POST to '/contacts' will create a contact.\n\nDeduplication\n\nWhen POSTing an entity, the TE API will attempt to 'Deduplicate' by searching for existing entities with similar attributes. If such a duplicate does exist, the TE API will treat the POST as a PATCH to that entity instead. See each section for details on what attributes will be used to search for duplicates.\n\n'PATCH'ing\n\nEntities can be updated in the TE system by PATCHing to individual endpoints. E.g. sending a PATCH to '/contacts/51151' will update the attributes of the contact with TE 'id' of '51151'.\n\n'DELETE'ing\n\nEntities can be deleted only by TE ID. Send a DELETE request to the appropriate individual entity endpoint to delete it.\n\nReturn Codes\n\nWhere applicable, the API will respond with an HTTP status code that indicates what happened during the request. Possible values include:\n\nHTTP CODES\n\nStatus Code\nGeneral Description\n\n200 SUCCESS\nThe operation completed successfully. See the response body for details (if applicable).\n\n201 CREATED\nThe object was created successfully. See the response body for details (if applicable).\n\n400 BAD REQUEST\nThe JSON supplied to the API was malformed and unparseable.\n\n401 UNAUTHORIZED\nThe request's credentials are invalid. This could mean your token has expired and should be renewed. See the response body for details.\n\n403 FORBIDDEN\nAn attempt was made to access a resource for which you do not have permission\n\n405 METHOD NOT ALLOWED\nAn attempt was made to interact with an endpoint in an unsupported manner, e.g. sending a POST to '/contacts/1'\n\n415 UNSUPPORTED MEDIA TYPE\nThe API endpoints expect a content type of 'media/json'\n\n422 UNPROCESSABLE ENTITY\nThe JSON body supplied is valid, but not processable semantically. For example, the 'owner' relationship for a contact refers to a User that does not exist in the TE system.\n\n418 I'M A TEAPOT\nThe API is a teapot (See the 'Heartbeat' section for details).\n\n503 SERVICE UNAVAILABLE\nThe API is unavailable. Please try your request again later. If this message persists, please contact Technical Support"
  contact:
    url: https://developer.totalexpert.net
servers:
- url: https://public.totalexpert.net
  description: Total Expert external API — production
- url: https://public.vt.totalexpert.net
  description: Total Expert external API — development/sandbox domain (isolated from live data; per the Vendor OAuth Integration Guide)
security:
- oauth2: []
tags:
- name: Lead Opportunities (New)
paths:
  /v1/lead-opportunities:
    post:
      operationId: missingRequiredFields
      summary: Missing Required Fields
      description: "Example error when required fields are missing.\n\nExpected Response (400):\n\n{\n  \"error\": \"Missing required fields. Must provide: first_name, last_name, source, and either phone or email\"\n}\n\nAlternate documented request: Create Lead Opportunity (Minimal).\n\nAlternate documented request: Create Lead Opportunity (Full)."
      tags:
      - Lead Opportunities (New)
      responses:
        '200':
          description: Success. See the Total Expert Public API documentation for the response shape.
      requestBody:
        content:
          application/json:
            examples:
              default:
                value:
                  first_name: John
              create-lead-opportunity-minimal:
                value:
                  first_name: John
                  last_name: Doe
                  source: website
                  email: john.doe@example.com
              create-lead-opportunity-full:
                value:
                  first_name: John
                  last_name: Doe
                  source: website
                  phone: 555-123-4567
                  email: john.doe@example.com
                  contact_id: 456
                  assigned_user:
                    user_id: 789
                  product:
                    type: mortgage
                    values:
                      loan_purpose: Purchase
                      loan_amount: 350000
                      property_type: Single-Family
                      property_state: CA
                      credit_score: 720
                  stage:
                    id: '1'
                    name: New Lead
                  referred_by: Jane Smith
                  utm_source: google
                  utm_campaign: spring_sale
                  utm_medium: cpc
    get:
      operationId: invalidFilterExpression
      summary: Invalid Filter Expression
      description: "Example error for invalid filter syntax.\n\nExpected Response (400):\n\n{\n  \"error\": \"Invalid filter expression: invalidfilter\"\n}\n\nAlternate documented request: Invalid Sort Field.\n\nAlternate documented request: Page Out of Range.\n\nAlternate documented request: List Lead Opportunities (Default).\n\nAlternate documented request: List with Pagination.\n\nAlternate documented request: Filter by Contact ID.\n\nAlternate documented request: Multiple Filters.\n\nAlternate documented request: Sort by Created Date (Descending).\n\nAlternate documented request: Sort by Updated Date (Ascending).\n\nAlternate documented request: Combined - Filter, Sort, Paginate."
      tags:
      - Lead Opportunities (New)
      responses:
        '200':
          description: Success. See the Total Expert Public API documentation for the response shape.
      parameters:
      - name: filter
        in: query
        required: false
        schema:
          type: string
        example: invalidfilter
  /v1/lead-opportunities/{lead_opportunity_id}:
    get:
      operationId: getLeadOpportunityById
      summary: Get Lead Opportunity by ID
      description: "Retrieve a specific lead opportunity by its unique identifier.\n\nPath Parameters:\n\nid - Lead opportunity UUID or alphanumeric ID\n\nResponse (200 OK):\n\n{\n  \"id\": \"550e8400-e29b-41d4-a716-446655440000\",\n  \"first_name\": \"John\",\n  \"last_name\": \"Doe\",\n  \"stage\": {\"id\": \"stage-123\", \"name\": \"New Lead\"},\n  \"product\": {\"type\": \"mortgage\", \"values\": {...}},\n  \"source\": {\"id\": 1, \"display_name\": \"Website\"},\n  \"assigned_user_id\": 789,\n  \"legacy_contact_id\": 456,\n  \"created_at\": \"2024-01-15T10:30:00Z\",\n  \"updated_at\": \"2024-01-16T14:20:00Z\"\n}\n\nResponse (404 Not Found):\n\n{\n  \"message\": \"Object with id '550e8400-e29b-41d4-a716-446655440000' not found\"\n}\n\ncURL:\n\ncurl \"{{external_api_host}}/v1/lead-opportunities/550e8400-e29b-41d4-a716-446655440000\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Accept: application/json\""
      tags:
      - Lead Opportunities (New)
      responses:
        '200':
          description: Success. See the Total Expert Public API documentation for the response shape.
      parameters:
      - name: lead_opportunity_id
        in: path
        required: true
        schema:
          type: string
    patch:
      operationId: updateLeadOpportunity
      summary: Update Lead Opportunity
      description: "Update an existing lead opportunity.\n\nRequired: contact_id (always required for updates)\n\nUpdate Behavior:\nThree independent operations:\n\nAssignment update (assigned_user_id)\n\nStage update (stage.id)\n\nLead opportunity update (other fields)\n\nProduct Values: Partial updates merge with existing values.\n\nMarketing attribution: utm_source, utm_campaign, utm_medium are optional strings, each patched independently. Omit a field to leave its stored value unchanged; send a field to overwrite it.\n\nResponse (200 OK):\n\n{\n  \"leadOpportunity\": {\"id\": \"...\", \"contact_id\": 456},\n  \"errors\": {\"stage\": \"Failed to update stage\"}\n}\n\ncURL Examples:\n\nUpdate assignment:\n\ncurl -X PATCH \"{{external_api_host}}/v1/lead-opportunities/550e8400-e29b-41d4-a716-446655440000\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"contact_id\": 456, \"assigned_user_id\": 999}'\n\nUpdate product:\n\ncurl -X PATCH \"{{external_api_host}}/v1/lead-opportunities/550e8400-e29b-41d4-a716-446655440000\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"contact_id\": 456, \"product\": {\"values\": {\"loan_amount\": 400000}}}'\n\nUpdate marketing attribution:\n\ncurl -X PATCH \"{{external_api_host}}/v1/lead-opportunities/550e8400-e29b-41d4-a716-446655440000\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"contact_id\": 456, \"utm_source\": \"bing\", \"utm_campaign\": \"summer_promo\", \"utm_medium\": \"email\"}'"
      tags:
      - Lead Opportunities (New)
      responses:
        '200':
          description: Success. See the Total Expert Public API documentation for the response shape.
      parameters:
      - name: lead_opportunity_id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            example:
              contact_id: 456
              first_name: Jane
              last_name: Smith
              email: jane.smith@example.com
              assigned_user:
                user_id: 999
              product:
                values:
                  loan_amount: 400000
                  credit_score: 750
              stage:
                id: stage-456
              utm_source: bing
              utm_campaign: summer_promo
              utm_medium: email
components:
  securitySchemes:
    oauth2:
      type: oauth2
      description: OAuth 2.0. Obtain a token from POST /v1/token using HTTP Basic (client_id:client_secret base64-encoded) plus a grant_type body. Access tokens are bearer tokens, expires_in 3600.
      flows:
        clientCredentials:
          tokenUrl: https://public.totalexpert.net/v1/token
          scopes:
            crm: Documented example scope (Vendor OAuth Integration Guide authorize example)
            leadInteraction: Lead interaction access (documented in the collection token examples)
            loanInteraction: Loan interaction access (documented in the collection token examples)
            leadSurveyInteraction: Lead survey interaction access (documented example in the Vendor OAuth Integration Guide)
            postLeads: Post leads access (documented example in the Vendor OAuth Integration Guide)
        authorizationCode:
          authorizationUrl: https://public.totalexpert.net/v1/authorize
          tokenUrl: https://public.totalexpert.net/v1/token
          refreshUrl: https://public.totalexpert.net/v1/token
          scopes:
            crm: Documented example scope (Vendor OAuth Integration Guide authorize example)
            leadInteraction: Lead interaction access (documented in the collection token examples)
            loanInteraction: Loan interaction access (documented in the collection token examples)
            leadSurveyInteraction: Lead survey interaction access (documented example in the Vendor OAuth Integration Guide)
            postLeads: Post leads access (documented example in the Vendor OAuth Integration Guide)
externalDocs:
  description: Total Expert Public API documentation (Postman)
  url: https://documenter.getpostman.com/view/1929166/total-expert-public-api/6Z2RYyU