Suno Music API

Music generation endpoints

OpenAPI Specification

suno-music-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Suno API (sunoapi.org) Lyrics Music API
  description: Third-party Suno API gateway (sunoapi.org) for AI music, lyrics, and audio generation. Suno itself does not publish a sanctioned developer API as of May 2026; this OpenAPI describes the public-facing endpoints documented at https://docs.sunoapi.org. Endpoints are asynchronous and rely on a callBackUrl for completion notifications, with task status retrievable via record-info endpoints.
  version: 1.0.0
  contact:
    name: sunoapi.org docs
    url: https://docs.sunoapi.org/
servers:
- url: https://api.sunoapi.org
  description: Production
security:
- bearerAuth: []
tags:
- name: Music
  description: Music generation endpoints
paths:
  /api/v1/generate:
    post:
      tags:
      - Music
      summary: Generate music
      description: Creates a music generation task. Returns a taskId; results are delivered via the callBackUrl when ready (stream URLs in ~30-40s, downloadable URLs in 2-3 minutes). Exactly two songs are returned per successful task.
      operationId: generateMusic
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateMusicRequest'
      responses:
        '200':
          description: Task accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskResponse'
  /api/v1/generate/record-info:
    get:
      tags:
      - Music
      summary: Get music generation details
      description: Retrieve the status and audio results for a music generation task.
      operationId: getMusicGenerationDetails
      parameters:
      - in: query
        name: taskId
        required: true
        schema:
          type: string
        description: The task ID returned from Generate Music or Extend Music.
      responses:
        '200':
          description: Task details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MusicRecordInfoResponse'
components:
  schemas:
    MusicRecordInfoResponse:
      type: object
      properties:
        code:
          type: integer
        msg:
          type: string
        data:
          type: object
          properties:
            taskId:
              type: string
            parentMusicId:
              type: string
            param:
              type: string
            response:
              type: object
              properties:
                taskId:
                  type: string
                sunoData:
                  type: array
                  items:
                    $ref: '#/components/schemas/SunoTrack'
            status:
              type: string
              enum:
              - PENDING
              - TEXT_SUCCESS
              - FIRST_SUCCESS
              - SUCCESS
              - CREATE_TASK_FAILED
              - GENERATE_AUDIO_FAILED
              - CALLBACK_EXCEPTION
              - SENSITIVE_WORD_ERROR
            type:
              type: string
              enum:
              - chirp-v3-5
              - chirp-v4
            operationType:
              type: string
              enum:
              - generate
              - extend
              - upload_cover
              - upload_extend
            errorCode:
              type: integer
              nullable: true
            errorMessage:
              type: string
              nullable: true
    TaskResponse:
      type: object
      properties:
        code:
          type: integer
          example: 200
        msg:
          type: string
          example: success
        data:
          type: object
          properties:
            taskId:
              type: string
    GenerateMusicRequest:
      type: object
      required:
      - customMode
      - instrumental
      - callBackUrl
      - model
      properties:
        customMode:
          type: boolean
          description: When true, requires style and title. Prompt required if instrumental=false.
        instrumental:
          type: boolean
        callBackUrl:
          type: string
          format: uri
        model:
          type: string
          description: Model identifier (e.g. chirp-v3-5, chirp-v4).
        prompt:
          type: string
        style:
          type: string
        title:
          type: string
        personaId:
          type: string
        personaModel:
          type: string
        negativeTags:
          type: string
        vocalGender:
          type: string
        styleWeight:
          type: number
        weirdnessConstraint:
          type: number
        audioWeight:
          type: number
    SunoTrack:
      type: object
      properties:
        id:
          type: string
        audioUrl:
          type: string
          format: uri
        streamAudioUrl:
          type: string
          format: uri
        imageUrl:
          type: string
          format: uri
        prompt:
          type: string
        modelName:
          type: string
        title:
          type: string
        tags:
          type: string
        createTime:
          type: string
          format: date-time
        duration:
          type: number
          description: Duration in seconds.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key