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

# Resolver metadados

> Analisa uma URL pública e retorna id (med_...), título, thumbnail e formatos.
Requer escopo media:resolve.
O campo data.id é usado como media_id no download. TTL padrão: 1 hora.




## OpenAPI

````yaml /openapi.yaml post /media/resolve
openapi: 3.1.0
info:
  title: Shappire Media API
  version: 1.0.0
  description: >
    API pública para resolver metadados de mídia e enfileirar downloads
    assíncronos.


    - Base URL produção: `https://api.shappire.tools/v1`

    - Autenticação: `X-API-Key` (recomendado) ou `Authorization: Bearer`

    - Envelope de sucesso: `{ "data": ... }`

    - Envelope de erro: `{ "error": { "code", "message", "request_id" } }`

    - YouTube não é suportado (bloqueio de IP de servidor)
servers:
  - url: https://api.shappire.tools/v1
    description: Production
  - url: http://localhost:8080/v1
    description: Local development
security:
  - ApiKeyAuth: []
  - BearerAuth: []
tags:
  - name: Health
    description: Status da API
  - name: Platforms
    description: Plataformas suportadas
  - name: Media
    description: Resolução e download de mídia
  - name: Jobs
    description: Consulta de jobs assíncronos
paths:
  /media/resolve:
    post:
      tags:
        - Media
      summary: Resolver metadados
      description: >
        Analisa uma URL pública e retorna id (med_...), título, thumbnail e
        formatos.

        Requer escopo media:resolve.

        O campo data.id é usado como media_id no download. TTL padrão: 1 hora.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MediaResolveRequest'
      responses:
        '200':
          description: Resolved media
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MediaResolveResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '403':
          description: Missing scope media:resolve
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '422':
          description: Invalid URL or unsupported platform
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
components:
  schemas:
    MediaResolveRequest:
      type: object
      required:
        - url
      properties:
        url:
          type: string
          format: uri
          maxLength: 2048
          description: URL pública HTTP(S) da mídia
    MediaResolveResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            id:
              type: string
              description: Identificador público (med_...) — use como media_id no download
              example: med_a1b2c3d4
            platform:
              type: string
              example: tiktok
            type:
              type: string
              enum:
                - video
                - audio
            title:
              type: string
            thumbnail:
              type: string
            duration:
              type: number
              description: Duração em segundos
            author:
              type: object
              properties:
                name:
                  type: string
                username:
                  type: string
            formats:
              type: array
              items:
                $ref: '#/components/schemas/MediaFormat'
    ErrorEnvelope:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Código estável para lógica do integrador
            message:
              type: string
              description: Mensagem legível (inglês)
            request_id:
              type: string
              description: ID de correlação — também em header X-Request-Id
    MediaFormat:
      type: object
      properties:
        id:
          type: string
          example: video_best
        type:
          type: string
          enum:
            - video
            - audio
            - image
        quality:
          type: string
        container:
          type: string
          example: mp4
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        Chave de API no formato shp_live_... (produção) ou shp_test_...
        (desenvolvimento)
    BearerAuth:
      type: http
      scheme: bearer
      description: Alternativa compatível — envie a chave como Bearer token

````