FusionAuth Message API

The Message API from FusionAuth — 3 operation(s) for message.

OpenAPI Specification

fusionauth-message-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  version: 1.66.0
  title: FusionAuth Api Key Message API
  description: This is a FusionAuth server. Find out more at [https://fusionauth.io](https://fusionauth.io). You need to [set up an API key](https://fusionauth.io/docs/v1/tech/apis/authentication#managing-api-keys) in the FusionAuth instance you are using to test out the API calls.
  license:
    name: Apache2
servers:
- url: http://localhost:9011
- url: https://sandbox.fusionauth.io
security:
- ApiKeyAuth: []
tags:
- name: Message
paths:
  /api/message/template:
    post:
      description: Creates an message template. You can optionally specify an Id for the template, if not provided one will be generated.
      operationId: createMessageTemplate
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MessageTemplateRequest'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageTemplateResponse'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
      tags:
      - Message
    get:
      description: Retrieves the message template for the given Id. If you don't specify the Id, this will return all the message templates.
      operationId: retrieveMessageTemplate
      parameters: []
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageTemplateResponse'
        default:
          description: Error
      tags:
      - Message
  /api/message/template/preview:
    post:
      description: Creates a preview of the message template provided in the request, normalized to a given locale.
      operationId: retrieveMessageTemplatePreviewWithId
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PreviewMessageTemplateRequest'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PreviewMessageTemplateResponse'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
      tags:
      - Message
  /api/message/template/{messageTemplateId}:
    post:
      description: Creates an message template. You can optionally specify an Id for the template, if not provided one will be generated.
      operationId: createMessageTemplateWithId
      parameters:
      - name: messageTemplateId
        in: path
        schema:
          type: string
        required: true
        description: The Id for the template. If not provided a secure random UUID will be generated.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MessageTemplateRequest'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageTemplateResponse'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
      tags:
      - Message
    delete:
      description: Deletes the message template for the given Id.
      operationId: deleteMessageTemplateWithId
      parameters:
      - name: messageTemplateId
        in: path
        schema:
          type: string
        required: true
        description: The Id of the message template to delete.
      responses:
        '200':
          description: Success
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
      tags:
      - Message
    patch:
      description: Updates, via PATCH, the message template with the given Id.
      operationId: patchMessageTemplateWithId
      parameters:
      - name: messageTemplateId
        in: path
        schema:
          type: string
        required: true
        description: The Id of the message template to update.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MessageTemplateRequest'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageTemplateResponse'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
      tags:
      - Message
    get:
      description: Retrieves the message template for the given Id. If you don't specify the Id, this will return all the message templates.
      operationId: retrieveMessageTemplateWithId
      parameters:
      - name: messageTemplateId
        in: path
        schema:
          type: string
        required: true
        description: The Id of the message template.
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageTemplateResponse'
        default:
          description: Error
      tags:
      - Message
    put:
      description: Updates the message template with the given Id.
      operationId: updateMessageTemplateWithId
      parameters:
      - name: messageTemplateId
        in: path
        schema:
          type: string
        required: true
        description: The Id of the message template to update.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MessageTemplateRequest'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageTemplateResponse'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
      tags:
      - Message
components:
  schemas:
    Errors:
      description: Standard error domain object that can also be used as the response from an API call.
      type: object
      properties:
        fieldErrors:
          type: array
          items:
            $ref: '#/components/schemas/Error'
        generalErrors:
          type: array
          items:
            $ref: '#/components/schemas/Error'
    MessageTemplate:
      description: Stores an message template used to distribute messages;
      type: object
      properties:
        data:
          type: object
          additionalProperties:
            type: object
        id:
          type: string
          format: uuid
        insertInstant:
          $ref: '#/components/schemas/ZonedDateTime'
        lastUpdateInstant:
          $ref: '#/components/schemas/ZonedDateTime'
        name:
          type: string
        type:
          $ref: '#/components/schemas/MessageType'
    ZonedDateTime:
      description: 'The number of milliseconds since the unix epoch: January 1, 1970 00:00:00 UTC. This value is always in UTC.'
      example: '1659380719000'
      type: integer
      format: int64
    MessageTemplateRequest:
      description: A Message Template Request to the API
      type: object
      properties:
        messageTemplate:
          $ref: '#/components/schemas/MessageTemplate'
    Error:
      description: Defines an error.
      type: object
      properties:
        code:
          type: string
        data:
          type: object
          additionalProperties:
            type: object
        message:
          type: string
    PreviewMessageTemplateResponse:
      description: ''
      type: object
      properties:
        errors:
          $ref: '#/components/schemas/Errors'
        message:
          $ref: '#/components/schemas/SMSMessage'
        previewMessage:
          type: string
    PreviewMessageTemplateRequest:
      description: ''
      type: object
      properties:
        locale:
          $ref: '#/components/schemas/Locale'
        messageTemplate:
          $ref: '#/components/schemas/MessageTemplate'
    SMSMessage:
      description: ''
      type: object
      properties:
        phoneNumber:
          type: string
        textMessage:
          type: string
    MessageTemplateResponse:
      description: ''
      type: object
      properties:
        messageTemplate:
          $ref: '#/components/schemas/MessageTemplate'
        messageTemplates:
          type: array
          items:
            $ref: '#/components/schemas/MessageTemplate'
    Locale:
      description: A Locale object represents a specific geographical, political, or cultural region.
      example: en_US
      type: string
    MessageType:
      description: ''
      type: string
      enum:
      - SMS
      - Voice
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      name: Authorization
      in: header
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT