Telnyx Media Storage API API

Media Storage operations

OpenAPI Specification

telnyx-media-storage-api-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  contact:
    email: support@telnyx.com
  description: Telnyx provides global communications and connectivity APIs for developers — including SIP trunking, programmable voice, SMS, MMS, WhatsApp Business Messaging, Call Control, Fax, Wireless (IoT & eSIM), Phone Numbers (DID provisioning & porting), Emergency Services, and Network APIs for private interconnects and edge connectivity. Build, scale, and manage voice, messaging, and data networks with Telnyx's carrier-grade global infrastructure and API-first platform.
  title: Telnyx Access Tokens Media Storage API API
  version: 2.0.0
  x-endpoint-cost: light
servers:
- description: Version 2.0.0 of the Telnyx API
  url: https://api.telnyx.com/v2
security:
- bearerAuth: []
tags:
- description: Media Storage operations
  name: Media Storage API
paths:
  /media:
    get:
      description: Returns a list of stored media files.
      operationId: ListMediaStorage
      parameters:
      - description: 'Consolidated filter parameter (deepObject style). Originally: filter[content_type][]'
        explode: true
        in: query
        name: filter
        schema:
          properties:
            content_type:
              description: Filters files by given content types
              items:
                example: application_xml
                type: string
              type: array
          type: object
        style: deepObject
      responses:
        '200':
          $ref: '#/components/responses/ListMediaResponse'
        '401':
          $ref: '#/components/responses/media-storage_GenericErrorResponse'
        default:
          $ref: '#/components/responses/media-storage_GenericErrorResponse'
      summary: List uploaded media
      tags:
      - Media Storage API
      x-latency-category: interactive
    post:
      description: Upload media file to Telnyx so it can be used with other Telnyx services
      operationId: CreateMediaStorage
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UploadMediaRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/UploadMediaMultipartRequest'
        description: Upload media request
        required: true
      responses:
        '201':
          $ref: '#/components/responses/MediaResponse'
        '401':
          $ref: '#/components/responses/media-storage_GenericErrorResponse'
        '422':
          $ref: '#/components/responses/media-storage_GenericErrorResponse'
        default:
          $ref: '#/components/responses/media-storage_GenericErrorResponse'
      summary: Upload media
      tags:
      - Media Storage API
      x-latency-category: interactive
  /media/{media_name}:
    delete:
      description: Deletes a stored media file.
      operationId: DeleteMediaStorage
      parameters:
      - $ref: '#/components/parameters/MediaName'
      responses:
        '204':
          description: The media was deleted successfully.
        '401':
          $ref: '#/components/responses/media-storage_GenericErrorResponse'
        '404':
          $ref: '#/components/responses/media-storage_GenericErrorResponse'
        default:
          $ref: '#/components/responses/media-storage_GenericErrorResponse'
      summary: Deletes stored media
      tags:
      - Media Storage API
      x-latency-category: interactive
    get:
      description: Returns the information about a stored media file.
      operationId: GetMediaStorage
      parameters:
      - $ref: '#/components/parameters/MediaName'
      responses:
        '200':
          $ref: '#/components/responses/MediaResponse'
        '401':
          $ref: '#/components/responses/media-storage_GenericErrorResponse'
        '404':
          $ref: '#/components/responses/media-storage_GenericErrorResponse'
        default:
          $ref: '#/components/responses/media-storage_GenericErrorResponse'
      summary: Retrieve stored media
      tags:
      - Media Storage API
      x-latency-category: interactive
    put:
      description: Updates a stored media file.
      operationId: UpdateMediaStorage
      parameters:
      - $ref: '#/components/parameters/MediaName'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateMediaRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/UpdateMediaMultipartRequest'
        description: Update media request
        required: true
      responses:
        '200':
          $ref: '#/components/responses/MediaResponse'
        '401':
          $ref: '#/components/responses/media-storage_GenericErrorResponse'
        '404':
          $ref: '#/components/responses/media-storage_GenericErrorResponse'
        '422':
          $ref: '#/components/responses/media-storage_GenericErrorResponse'
        default:
          $ref: '#/components/responses/media-storage_GenericErrorResponse'
      summary: Update stored media
      tags:
      - Media Storage API
      x-latency-category: interactive
  /media/{media_name}/download:
    get:
      description: Downloads a stored media file.
      operationId: DownloadMedia
      parameters:
      - $ref: '#/components/parameters/MediaName'
      responses:
        '200':
          $ref: '#/components/responses/MediaDownloadResponse'
        '401':
          $ref: '#/components/responses/media-storage_GenericErrorResponse'
        '404':
          $ref: '#/components/responses/media-storage_GenericErrorResponse'
        '422':
          $ref: '#/components/responses/media-storage_GenericErrorResponse'
        default:
          $ref: '#/components/responses/media-storage_GenericErrorResponse'
      summary: Download stored media
      tags:
      - Media Storage API
      x-latency-category: interactive
components:
  schemas:
    UpdateMediaRequest:
      example:
        media_url: http://www.example.com/audio.mp3
        ttl_secs: 86400
      properties:
        media_url:
          description: The URL where the media to be stored in Telnyx network is currently hosted. The maximum allowed size is 20 MB.
          example: http://www.example.com/audio.mp3
          type: string
        ttl_secs:
          description: The number of seconds after which the media resource will be deleted, defaults to 2 days. The maximum allowed vale is 630720000, which translates to 20 years.
          example: 86400
          type: integer
      title: Upload media request
      type: object
    MediaResource:
      example:
        content_type: application/xml
        created_at: '2019-01-23T18:10:02.574Z'
        expires_at: '2020-01-23T18:10:02.574Z'
        media_name: f5586561-8ff0-4291-a0ac-84fe544797bd
        updated_at: '2019-01-23T18:10:02.574Z'
      properties:
        content_type:
          description: Content type of the file
          example: application/xml
          type: string
        created_at:
          description: ISO 8601 formatted date of when the media resource was created
          example: '2019-01-23T18:10:02.574Z'
          type: string
        expires_at:
          description: ISO 8601 formatted date of when the media resource will expire and be deleted.
          example: '2020-01-23T18:10:02.574Z'
          type: string
        media_name:
          description: Uniquely identifies a media resource.
          type: string
        updated_at:
          description: ISO 8601 formatted date of when the media resource was last updated
          example: '2019-01-23T18:10:02.574Z'
          type: string
      title: Media Resource
      type: object
    media-storage_Errors:
      properties:
        errors:
          items:
            $ref: '#/components/schemas/media-storage_Error'
          type: array
      type: object
    media-storage_Error:
      properties:
        code:
          type: string
        detail:
          type: string
        meta:
          additionalProperties: true
          type: object
        source:
          properties:
            parameter:
              description: Indicates which query parameter caused the error.
              type: string
            pointer:
              description: JSON pointer (RFC6901) to the offending entity.
              type: string
          type: object
        title:
          type: string
      required:
      - code
      - title
      type: object
    PaginationMeta:
      properties:
        page_number:
          example: 2
          type: integer
        page_size:
          example: 25
          type: integer
        total_pages:
          example: 3
          type: integer
        total_results:
          example: 55
          type: integer
      type: object
    UploadMediaRequest:
      example:
        media_name: my-file
        media_url: http://www.example.com/audio.mp3
        ttl_secs: 86400
      properties:
        media_name:
          description: The unique identifier of a file.
          example: my_file
          type: string
        media_url:
          description: The URL where the media to be stored in Telnyx network is currently hosted. The maximum allowed size is 20 MB.
          example: http://www.example.com/audio.mp3
          type: string
        ttl_secs:
          description: The number of seconds after which the media resource will be deleted, defaults to 2 days. The maximum allowed vale is 630720000, which translates to 20 years.
          example: 86400
          type: integer
      required:
      - media_url
      title: Upload media request
      type: object
    UploadMediaMultipartRequest:
      example:
        media: string($binary)
        media_name: my-file
        ttl_secs: 86400
      properties:
        media:
          description: The file you want to upload. The maximum allowed size is 20 MB.
          format: binary
          type: string
        media_name:
          description: The unique identifier of a file.
          example: my_file
          type: string
        ttl_secs:
          description: The number of seconds after which the media resource will be deleted, defaults to 2 days. The maximum allowed vale is 630720000, which translates to 20 years.
          example: 86400
          type: integer
      required:
      - media
      title: Upload media multipart request
      type: object
    UpdateMediaMultipartRequest:
      example:
        media: string($binary)
        ttl_secs: 86400
      properties:
        media:
          description: The file you want to upload. The maximum allowed size is 20 MB.
          format: binary
          type: string
        ttl_secs:
          description: The number of seconds after which the media resource will be deleted, defaults to 2 days. The maximum allowed vale is 630720000, which translates to 20 years.
          example: 86400
          type: integer
      title: Upload media multipart request
      type: object
  responses:
    MediaDownloadResponse:
      content:
        application/octet-stream:
          schema:
            format: binary
            type: string
      description: A response describing a media resource
    media-storage_GenericErrorResponse:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/media-storage_Errors'
      description: Unexpected error
    ListMediaResponse:
      content:
        application/json:
          schema:
            properties:
              data:
                items:
                  $ref: '#/components/schemas/MediaResource'
                type: array
              meta:
                $ref: '#/components/schemas/PaginationMeta'
            title: List of media resources response
            type: object
      description: A response with a list of media resources
    MediaResponse:
      content:
        application/json:
          schema:
            properties:
              data:
                $ref: '#/components/schemas/MediaResource'
            title: Media resource response
            type: object
      description: A response describing a media resource
  parameters:
    MediaName:
      description: Uniquely identifies a media resource.
      in: path
      name: media_name
      required: true
      schema:
        type: string
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http
    branded-calling_bearerAuth:
      description: API key passed as a Bearer token in the Authorization header
      scheme: bearer
      type: http
    oauthClientAuth:
      description: OAuth 2.0 authentication for Telnyx API and MCP integrations
      flows:
        authorizationCode:
          authorizationUrl: https://api.telnyx.com/v2/oauth/authorize
          refreshUrl: https://api.telnyx.com/v2/oauth/token
          scopes:
            admin: Administrative access to Telnyx resources
          tokenUrl: https://api.telnyx.com/v2/oauth/token
        clientCredentials:
          scopes:
            admin: Administrative access to Telnyx resources
          tokenUrl: https://api.telnyx.com/v2/oauth/token
      type: oauth2
    outbound-voice-profiles_bearerAuth:
      bearerFormat: JWT
      scheme: bearer
      type: http
    pronunciation-dicts_bearerAuth:
      description: Telnyx API v2 key. Obtain from https://portal.telnyx.com
      scheme: bearer
      type: http
    stored-payment-transactions_bearerAuth:
      bearerFormat: JWT
      scheme: bearer
      type: http