> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sdk.anghami.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AcquireMusicStream

> AcquireMusicStream acquires a stream URL for playing a song.
 This is the billable event for music playback.



## OpenAPI

````yaml /api/anghami-sdk.openapi.yaml post /v1/streaming/music
openapi: 3.1.0
info:
  title: Anghami + OSN+ SDK
  description: >-
    Unified OpenAPI bundle covering all Anghami + OSN+ SDK services (music +
    video streaming).
  contact:
    name: Anghami Developer Platform
    email: developers@anghami.com
  version: 1.0.0
servers:
  - url: https://sdk.anghami.com
security: []
paths:
  /v1/streaming/music:
    post:
      tags:
        - StreamingService
      summary: AcquireMusicStream
      description: |-
        AcquireMusicStream acquires a stream URL for playing a song.
         This is the billable event for music playback.
      operationId: AcquireMusicStream
      parameters:
        - name: Authorization
          in: header
          description: >-
            OAuth 2.0 Bearer token with the 'stream' scope. Required for all
            streaming operations. Format: Bearer <access_token>.
          required: true
          schema:
            type: string
            example: Bearer eyJhbGciOiJSUzI1NiIs...
        - name: Accept-Language
          in: header
          description: Preferred locale for error messages and metadata (BCP 47).
          required: false
          schema:
            type: string
            example: ar
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/sdk_streaming_v1_AcquireMusicStreamRequest'
        required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/sdk_streaming_v1_AcquireMusicStreamResponse
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        default:
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    sdk_streaming_v1_AcquireMusicStreamRequest:
      type: object
      properties:
        songId:
          $ref: '#/components/schemas/sdk_shared_v1_SongID'
        maxQuality:
          type: string
          enum:
            - AUDIO_QUALITY_UNSPECIFIED
            - AUDIO_QUALITY_LOW
            - AUDIO_QUALITY_STANDARD
            - AUDIO_QUALITY_HIGH
            - AUDIO_QUALITY_LOSSLESS
          description: AudioQuality enumerates the available audio stream quality tiers.
      required:
        - songId
      description: >-
        AcquireMusicStreamRequest is the request message for acquiring a music
        stream.
         This is the billable event for music playback.
    sdk_streaming_v1_AcquireMusicStreamResponse:
      type: object
      properties:
        stream:
          $ref: '#/components/schemas/sdk_streaming_v1_StreamInfo'
      description: >-
        AcquireMusicStreamResponse is the response message containing the music
        stream details.
    ValidationError:
      type: object
      properties:
        violations:
          type: array
          items:
            $ref: '#/components/schemas/FieldViolation'
          description: List of validation violations
      required:
        - violations
      description: >-
        ValidationError is returned when request validation fails. It contains a
        list of field violations describing what went wrong.
    Error:
      type: object
      properties:
        message:
          type: string
          description: Error message (e.g., 'user not found', 'database connection failed')
      description: >-
        Error is returned when a handler encounters an error. It contains a
        simple error message that the developer can customize.
    sdk_shared_v1_SongID:
      type: object
      properties:
        value:
          type: string
          description: The string value of the song identifier.
      required:
        - value
      description: SongID is a typed identifier for a song.
    sdk_streaming_v1_StreamInfo:
      type: object
      properties:
        manifestUrl:
          type: string
          description: URL of the streaming manifest (HLS m3u8 or DASH mpd).
        drmScheme:
          type: string
          enum:
            - DRM_SCHEME_UNSPECIFIED
            - DRM_SCHEME_FAIRPLAY
            - DRM_SCHEME_WIDEVINE
            - DRM_SCHEME_PLAYREADY
            - DRM_SCHEME_CLEARKEY
          description: |-
            DrmScheme enumerates the supported Digital Rights Management systems
             for protecting streamed content.
        licenseUrl:
          type: string
          description: |-
            URL of the DRM license server.
             Empty when drm_scheme is UNSPECIFIED or CLEARKEY.
        drmParams:
          type: object
          additionalProperties:
            type: string
          description: |-
            Additional DRM parameters required by the client.
             Keys and values are DRM-scheme-specific (e.g., "certificate_url" for FairPlay).
        expiresInSeconds:
          type: integer
          format: int32
          description: |-
            Number of seconds until this stream URL expires.
             The client must re-acquire the stream after expiration.
        availableQualities:
          type: array
          items:
            $ref: '#/components/schemas/sdk_streaming_v1_QualityOption'
      description: |-
        StreamInfo contains the information required to play a stream.
         Returned by all stream acquisition RPCs.
    FieldViolation:
      type: object
      properties:
        field:
          type: string
          description: >-
            The field path that failed validation (e.g., 'user.email' for nested
            fields). For header validation, this will be the header name (e.g.,
            'X-API-Key')
        description:
          type: string
          description: >-
            Human-readable description of the validation violation (e.g., 'must
            be a valid email address', 'required field missing')
      required:
        - field
        - description
      description: FieldViolation describes a single validation error for a specific field.
    sdk_streaming_v1_QualityOption:
      type: object
      properties:
        label:
          type: string
          description: Human-readable label (e.g., "High (256 kbps)", "1080p").
        bitrateKbps:
          type: integer
          format: int32
          description: Bitrate in kilobits per second.
        codec:
          type: string
          description: Codec identifier (e.g., "aac", "flac", "h264", "hevc").
      description: QualityOption describes a single quality tier available for a stream.

````