{
  "openapi": "3.1.0",
  "info": {
    "title": "Mashahid API",
    "version": "1.1.0",
    "description": "Create branded motion-graphics videos with Arabic or English voice-over, up to 10 minutes. Credits: flow 30/min, lens 60/min, canvas 70/min. Plans: Trial $0 = 45 credits; Creator $29 = 900 credits/month; Business $79 = 3000 credits/month. Top-up: $1 = 30 credits. Rate limit: 30 requests/minute per key."
  },
  "servers": [
    {
      "url": "https://mashahid.pages.dev/api/v1"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "msh_live_..."
      }
    },
    "schemas": {
      "Video": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "scripting",
              "voicing",
              "rendering",
              "ready",
              "failed"
            ]
          },
          "progress": {
            "type": "integer"
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "model": {
            "type": "string",
            "enum": [
              "flow",
              "lens",
              "canvas"
            ]
          },
          "video_type": {
            "type": "string"
          },
          "duration_s": {
            "type": "integer"
          },
          "aspect": {
            "type": "string"
          },
          "from_document": {
            "type": "boolean"
          },
          "credits_cost": {
            "type": "integer",
            "description": "Credits charged; auto-length videos are settled to the real length after rendering"
          },
          "video_url": {
            "type": "string",
            "nullable": true
          },
          "srt_url": {
            "type": "string",
            "nullable": true
          },
          "cover_url": {
            "type": "string",
            "nullable": true
          },
          "post_text": {
            "type": "string",
            "nullable": true
          },
          "post_images": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "post_1x1, post_4x5, post_16x9, post_9x16, slide_1..5 → URL"
          },
          "post_images_status": {
            "type": "string",
            "enum": [
              "none",
              "queued",
              "working",
              "done",
              "failed"
            ]
          },
          "error": {
            "type": "string",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string",
            "description": "Arabic, human readable"
          }
        }
      }
    }
  },
  "security": [
    {
      "bearer": []
    }
  ],
  "paths": {
    "/videos": {
      "post": {
        "summary": "Create a video (per started 30 seconds: flow 15, lens 30, canvas 35 credits)",
        "operationId": "createVideo",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "idea is required unless document_url is given",
                "properties": {
                  "idea": {
                    "type": "string",
                    "maxLength": 2000,
                    "description": "One word is enough; optional with document_url (then: what to focus on)"
                  },
                  "document_url": {
                    "type": "string",
                    "format": "uri",
                    "description": "Public https link to a PDF (profile, catalogue, menu, report; up to 25 MB). The video is built from its facts, contacts and own pictures."
                  },
                  "model": {
                    "type": "string",
                    "enum": [
                      "flow",
                      "lens",
                      "canvas"
                    ],
                    "default": "flow",
                    "description": "flow = pure motion, lens = motion + cinematic photos, canvas = motion + an illustration per scene"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "questions",
                      "myths",
                      "story",
                      "manifesto",
                      "idea_to_product",
                      "info",
                      "promo",
                      "launch",
                      "how_to",
                      "before_after",
                      "tips",
                      "faq",
                      "comparison",
                      "announcement"
                    ],
                    "default": "auto"
                  },
                  "duration": {
                    "oneOf": [
                      {
                        "type": "string",
                        "enum": [
                          "auto"
                        ]
                      },
                      {
                        "type": "integer",
                        "minimum": 10,
                        "maximum": 600
                      }
                    ],
                    "default": "auto"
                  },
                  "aspect": {
                    "type": "string",
                    "enum": [
                      "9:16",
                      "4:5",
                      "1:1",
                      "16:9"
                    ],
                    "default": "9:16"
                  },
                  "tone": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "confident",
                      "energetic",
                      "cinematic",
                      "warm",
                      "formal"
                    ],
                    "default": "auto"
                  },
                  "language": {
                    "type": "string",
                    "enum": [
                      "ar",
                      "en"
                    ],
                    "default": "ar"
                  },
                  "voice": {
                    "type": "string",
                    "enum": [
                      "auto",
                      "ar-faisal",
                      "ar-layla",
                      "ar-fahad",
                      "ar-tariq",
                      "ar-maryam",
                      "ar-jana",
                      "ar-noura",
                      "ar-abdullah",
                      "ar-sara",
                      "ar-reem",
                      "ar-hamad",
                      "ar-youssef",
                      "ar-menna",
                      "ar-karim",
                      "ar-lin",
                      "ar-samer",
                      "ar-majed",
                      "ar-dalia",
                      "ar-khalid",
                      "ar-rana",
                      "en-james",
                      "en-olivia",
                      "en-ethan",
                      "en-sophia",
                      "en-oliver",
                      "en-amelia",
                      "en-noah",
                      "en-mia",
                      "en-liam",
                      "en-ava",
                      "en-lucas",
                      "en-grace",
                      "en-henry",
                      "en-chloe",
                      "en-daniel"
                    ],
                    "default": "auto"
                  },
                  "voice_settings": {
                    "type": "object",
                    "properties": {
                      "speed": {
                        "type": "number",
                        "minimum": 0.75,
                        "maximum": 1.35
                      },
                      "pitch": {
                        "type": "number",
                        "minimum": -4,
                        "maximum": 4
                      },
                      "warmth": {
                        "type": "number",
                        "minimum": -1,
                        "maximum": 1
                      },
                      "energy": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 2
                      },
                      "pauses": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 2
                      }
                    }
                  },
                  "captions": {
                    "type": "string",
                    "enum": [
                      "boxed",
                      "bold",
                      "minimal",
                      "none"
                    ],
                    "default": "boxed"
                  },
                  "sound_effects": {
                    "type": "boolean",
                    "default": true
                  },
                  "brand_id": {
                    "type": "string",
                    "format": "uuid"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Video"
                }
              }
            }
          },
          "401": {
            "description": "invalid_api_key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string",
                      "description": "Arabic, human readable"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "no_credits"
          },
          "403": {
            "description": "plan_required"
          },
          "422": {
            "description": "invalid_request"
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string",
                      "description": "Arabic, human readable"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "List recent videos",
        "operationId": "listVideos",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Video"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "invalid_api_key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string",
                      "description": "Arabic, human readable"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string",
                      "description": "Arabic, human readable"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/videos/{id}": {
      "get": {
        "summary": "Get a video",
        "operationId": "getVideo",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Video"
                }
              }
            }
          },
          "401": {
            "description": "invalid_api_key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string",
                      "description": "Arabic, human readable"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found"
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string",
                      "description": "Arabic, human readable"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/videos/{id}/images": {
      "post": {
        "summary": "Make post images from a ready video (free): 1:1, 4:5, 16:9, 9:16 + carousel slides",
        "operationId": "createPostImages",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "with_text": {
                    "type": "boolean",
                    "default": true,
                    "description": "false = clean images without the headline"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "post_images_status": {
                      "type": "string"
                    },
                    "with_text": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "invalid_api_key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string",
                      "description": "Arabic, human readable"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "not_found"
          },
          "409": {
            "description": "video_not_ready"
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string",
                      "description": "Arabic, human readable"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/me": {
      "get": {
        "summary": "Plan, credits (with USD value) and brands",
        "operationId": "me",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "plan": {
                      "type": "string"
                    },
                    "credits": {
                      "type": "integer"
                    },
                    "credits_usd": {
                      "type": "number"
                    },
                    "brands": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "invalid_api_key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string",
                      "description": "Arabic, human readable"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string",
                      "description": "Arabic, human readable"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/voices": {
      "get": {
        "summary": "Voice library with sample URLs",
        "operationId": "voices",
        "security": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/types": {
      "get": {
        "summary": "Supported types and options",
        "operationId": "types",
        "security": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  }
}