LendKey email API

The email API from LendKey — 2 operation(s) for email.

OpenAPI Specification

lendkey-email-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: LendKey E-Sign API (via Kong Gateway) Application Contracts email API
  version: 0.1
  description: "# LendKey E-Sign API - Kong Gateway Documentation\n\n## Overview\n\nThe LendKey E-Sign API provides endpoints for creating and managing electronic signature contracts using DocuSign.\nThis API is accessed through Kong Gateway, which handles authentication via OAuth2.\n\n## Authentication\n\nAll requests to this API require OAuth2 authentication through Kong Gateway.\n\n### Step 1: Get OAuth2 Token\n\nBefore calling any endpoint, you must obtain an access token:\n\n**Production Environment:**\n```bash\ncurl -X POST https://api.lendkey.com/esign/oauth2/token \\\n  -d \"grant_type=client_credentials\" \\\n  -d \"client_id=YOUR_CLIENT_ID\" \\\n  -d \"client_secret=YOUR_CLIENT_SECRET\"\n```\n\n**Response:**\n```json\n{\n  \"access_token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\",\n  \"token_type\": \"bearer\",\n  \"expires_in\": 7200\n}\n```\n\n### Step 2: Use Token in API Calls\n\nInclude the access token in the `Authorization` header:\n```\nAuthorization: Bearer YOUR_ACCESS_TOKEN\n```\n\n**Token Lifetime:** 2 hours (7200 seconds)\n\n## Base URLs (Kong Gateway)\n\n| Environment | Kong Base URL | Backend Kubernetes Service |\n|------------|---------------|---------------------------|\n| **Production** | `https://api.lendkey.com/esign` | `main-esign-kotlin.ci.lkeyprod.com` |\n\n## How Kong Routes Requests\n\nWhen you call Kong:\n```\nhttps://api.lendkey.com/esign/applications\n```\n\nKong:\n1. Validates your OAuth2 token\n2. Strips the `/esign` prefix\n3. Forwards to: `http://main-esign-kotlin.ci.lkeyprod.com/applications`\n\nYou don't need to manage any backend authentication - Kong handles everything!\n\n## Getting Started\n\n1. **Get Credentials:** Contact your Kong admin or use the Kong Developer Portal\n2. **Get Token:** Use the OAuth2 token endpoint for your environment\n3. **Call API:** Use the token in the Authorization header\n4. **Refresh:** Get a new token every 2 hours\n"
  contact:
    name: LendKey Platform Team
    url: https://lendkey.com
servers:
- url: https://api.lendkey.com/esign
  description: Production Environment
security:
- oauth2: []
tags:
- name: email
paths:
  /v1/notifications/emails:
    summary: Endpoints for all things email related.
    post:
      tags:
      - email
      summary: Send An Email Notification
      description: Sends an email notification.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/emailRecordRequestPayload'
      responses:
        202:
          description: OK
          content:
            application/hal+json:
              schema:
                $ref: '#/components/schemas/emailRecord'
        400:
          $ref: '#/components/responses/BadRequest'
        500:
          $ref: '#/components/responses/UnexpectedError'
  /v1/notifications/emails/templates:
    get:
      tags:
      - email
      summary: Returns a list of ALL email templates available for use via notifier-api.
      description: Lists out ALL email templates known to this service, regardless of their provider (i.e. SendGrid).
      responses:
        200:
          description: OK
          content:
            application/hal+json:
              schema:
                $ref: '#/components/schemas/emailTemplateList'
        400:
          $ref: '#/components/responses/BadRequest'
        500:
          $ref: '#/components/responses/UnexpectedError'
components:
  schemas:
    emailRecordRequestPayload:
      type: object
      required:
      - provider
      - paylaod
      properties:
        provider:
          type: string
          description: The email service provider to use when sending this email.
          example: SENDGRID
        payload:
          type: object
          anyOf:
          - $ref: '#/components/schemas/emailRecordDto'
    emailSubstitution:
      type: object
      properties:
        id:
          type: integer
        tag:
          type: string
      example:
        id: 2
        tag: clientName
    emailTemplateList:
      type: object
      properties:
        _embedded:
          type: object
          properties:
            emailTemplates:
              type: array
              items:
                $ref: '#/components/schemas/emailTemplate'
        _links:
          type: object
          properties:
            self:
              $ref: '#/components/schemas/link'
        page:
          $ref: '#/components/schemas/page'
      example:
        _embedded:
          emailTemplates:
          - keyName: HIL_Application_Invitation
            externalTemplateProvider: SendGrid
            externalTemplateId: ''
            emailSubstitutions:
            - id: 2
              tag: clientName
            - id: 1
              tag: dealName
        _links:
          self:
            href: http://localhost:8080/v1/emailTemplates?page=0&size=20
          first:
            href: http://localhost:8080/v1/emailTemplates?page=0&size=20
          next:
            href: http://localhost:8080/v1/emailTemplates?page=1&size=20
          last:
            href: http://localhost:8080/v1/emailTemplates?page=1&size=20
        page:
          size: 20
          totalElements: 1
          totalPages: 1
          number: 0
    error:
      type: object
      properties:
        id:
          type: string
          format: uuid
        status:
          type: string
        timestamp:
          type: string
        message:
          type: string
        debugMessage:
          type: string
        subErrors:
          type: array
          items:
            $ref: '#/components/schemas/suberror'
      example:
        id: null
        status: BAD_REQUEST
        timestamp: '2019-10-21 14:07:59'
        message: Validation error
        debugMessage: null
        subErrors:
        - object: Resource
          field: name
          rejectedValue: null
          message: must not be null
    page:
      type: object
      properties:
        size:
          type: integer
        totalElements:
          type: integer
        totalPages:
          type: integer
        number:
          type: integer
    recipient:
      type: object
      required:
      - recipientAddress
      - recipientName
      properties:
        recipientAddress:
          type: string
        recipientName:
          type: string
      example:
        recipientName: John Doe
        recipientAddress: doe.john@gmali.com
    emailTemplate:
      type: object
      properties:
        keyName:
          type: string
        externalTemplateProvider:
          type: string
        externalTemplateId:
          type: string
        emailSubstitutions:
          type: array
          items:
            $ref: '#/components/schemas/emailSubstitution'
      example:
        keyName: HIL_Application_Invitation
        externalTemplateProvider: SendGrid
        externalTemplateId: ''
        emailSubstitutions:
        - $ref: '#/components/schemas/emailSubstitution'
    link:
      type: object
      properties:
        href:
          type: string
    suberror:
      type: object
      properties:
        object:
          type: string
        field:
          type: string
        rejectedValue:
          type: string
        message:
          type: string
      example:
        object: Resource
        field: name
        rejectedValue: null
        message: must not be null
    emailRecordDto:
      type: object
      required:
      - fromName
      - contentType
      properties:
        emailTemplate:
          type: string
          description: Optional. Specifies which email template should be used - uses a default template with no handlebar tags if one is not provided.
          example: HIL_Application_Invitation
        fromAddress:
          type: string
          description: Required. Specifies who the recipient will see the email is from.
          example: john.doe@test.com
        fromName:
          type: string
          description: Required. Specifies the name the recipient will see the email is from.
          example: John Doe
        to:
          type: array
          items:
            anyOf:
            - $ref: '#/components/schemas/recipient'
          description: Optional, if at least one bcc recipient is provided - otherwise at least one required. The Recipient(s) of the email.
        bcc:
          type: array
          items:
            anyOf:
            - $ref: '#/components/schemas/recipient'
          description: Optional, if at least one to recipient is provided - otherwise at least one required. The BCC Recipient(s) of the email.
        subject:
          type: string
          description: Optional - however certain templates may not support overriding the subject contents.
          example: Your Attention Required!
        body:
          type: string
          description: Optional - however certain templates may not support overriding the body contents.
          example: We need more information from you before we can proceed with your application. Please call us!
        contentType:
          type: string
          description: Required if body is provided. The content type of the email.
          example: text/plain
        personalizations:
          type: object
          description: Optional. Required only if a template is specified that contains handlebar tags.
          additionalProperties:
            type: object
            properties:
              personalizationTagKeyName:
                type: string
                description: The handlebar tag name, as specified in the email template, which is to be overridden with the corresponding value.
              personalizaitonTagValue:
                type: string
                description: The value to be inserted for the given handlebar tag in the specified email template.
          example:
            dealName: Example
            clientName: Some Credit Union
            subject: Boarding File Success
            firstName: John
            lastName: Doe
            body: We've received your document.
    emailRecord:
      type: object
      properties:
        emailTemplate:
          type: string
          description: Optional. Specifies which email template should be used - uses a default template with no handlebar tags if one is not provided.
          example: DEFAULT
        fromAddress:
          type: string
          description: Required. Specifies who the recipient will see the 'from' email address is.
        fromName:
          type: string
          description: Required. Specifies who the recipient will see the email is from.
        to:
          type: array
          items:
            anyOf:
            - $ref: '#/components/schemas/recipient'
          description: Optional, if at least one bcc recipient is provided - otherwise at least one required. The Recipient(s) of the email.
        bcc:
          type: array
          items:
            anyOf:
            - $ref: '#/components/schemas/recipient'
          description: Optional, if at least one to recipient is provided - otherwise at least one required. The BCC Recipient(s) of the email.
        subject:
          type: string
          description: Required - however certain templates may not support overriding the subject contents.
        body:
          type: string
          description: Optional. The content body of the email, if present.
        contentType:
          type: string
          description: Required if body is provided. The content type of the email.
        sentAt:
          type: string
          format: date-time
          description: When the email was sent.
        responseReceivedAt:
          type: string
          format: date-time
          description: Tracks when this emails response was received.
        responseStatusCode:
          type: integer
          description: Tracks the response code to this email.
        responseBody:
          type: string
          description: Tracks the response body of this email.
        clientApplication:
          type: string
          description: Specifies which client application requested this email be sent.
        clientApplicationUser:
          type: string
          description: Specifies the user of the client application that requested the email be sent, or the system user.
        personalizations:
          type: object
          description: Optional. Required only if a template is specified that contains handlebar tags.
          additionalProperties:
            type: object
            properties:
              personalizationTagKeyName:
                type: string
                description: The handlebar tag name, as specified in the email template, which is to be overridden with the corresponding value.
              personalizaitonTagValue:
                type: string
                description: The value to be inserted for the given handlebar tag in the specified email template.
          example:
            dealName: Example
            clientName: Some Credit Union
            subject: Boarding File Success
            firstName: John
            lastName: Doe
            body: We've received your document.
      example:
        emailTemplate: xx-sasdgkji2h3sdsfs
        fromName: LendKey
        fromAddress: something@lendkey.com
        to:
        - recipientName: John Doe
          recipientAddress: doe.john@gmali.com
        bcc:
        - recipientName: Jane Doe
          recipientAddress: doe.jane@gmali.com
        subject: Test
        body: Test
        contentType: text/plain
        sentAt: 2021-08-1310:39:59
        responseReceivedAt: 2021-08-1310:40:03
        responseStatusCode: '202'
        responseBody: Example body
        clientApplication: DSP
        clientApplicationUser: john.doe@lendkey.com
        personalizations:
          dealName: Example
          clientName: Some Credit Union
          subject: Boarding File Success
          firstName: John
          lastName: Doe
          body: We've received your document.
  responses:
    UnexpectedError:
      description: An unexpected server error occurred.
      content:
        application/hal+json:
          schema:
            $ref: '#/components/schemas/error'
          example:
            id: b6c52a48-551a-42ef-b361-f642d25cfeb7
            status: INTERNAL_SERVER_ERROR
            timestamp: '2019-10-21 14:07:59'
            message: An internal issue occurred.  Please try again shortly.  If the issue persists, contact us with all of the data in this error message.
            debugMessage: null
    BadRequest:
      description: Invalid request, unable to process the request with the information provided.
      content:
        application/hal+json:
          schema:
            $ref: '#/components/schemas/error'
          example:
            id: b6c52a48-551a-42ef-b361-f642d25cfeb7
            status: BAD_REQUEST
            timestamp: '2019-10-21 14:07:59'
            message: Describes what was invalid about the request, if possible.
            debugMessage: null
  securitySchemes:
    oauth2:
      type: oauth2
      description: OAuth2 client credentials flow via Kong Gateway
      flows:
        clientCredentials:
          tokenUrl: /oauth2/token
          scopes: {}