Discussions

Ask a Question
Back to All

Getting "Invalid Params" error in streaming.start

I was successful in getting the token and session id. Once i pass on the session id to the streaming task, i get


    // Step 2: Create session
    const newRes = await fetch("https://api.heygen.com/v1/streaming.new", {
      method: "POST",
      headers: {
        "x-api-key": HEYGEN_API_KEY,
        "Content-Type": "application/json"
      },
      body: JSON.stringify({
        avatar_name: AVATAR_NAME,
        token,
        voice_id: "e3f01ccc931744e195b90751bb9fc284"
      })
    });

    const newData = await newRes.json();
    if (newData.code !== 100 || !newData.data?.session_id) {
      log("❌ Failed to create session: " + JSON.stringify(newData));
      return;
    }

    const session_id = newData.data.session_id;
    sessionId = session_id;

    // Step 3: Start session
    const startRes = await fetch("https://api.heygen.com/v1/streaming.start", {
      method: "POST",
      headers: {
        "x-api-key": HEYGEN_API_KEY,
        "Content-Type": "application/json"
      },
      body: JSON.stringify({ session_id : sessionId })
    });

{"code":400006,"message":"Invalid params"}