javascript – POST http://127.0.0.1:8000/pruebi/prueba 422 (Unprocessable Entity)

I am having an error in my code when I try to upload a text (which is passed as input in a form by nextjs) to a mongodb database through my api (in fastapi). It puts 422 (Unprocessable Entity) but I don’t know why.
My code is divided into three parts, a first (the fronted) where I have the input and perform the fetch to try to send this to the api, my python code that uploads the data that is passed to mongodb and a routes method that is called by the fronted and which in turn is the one that calls the python code.
I leave my code here and I hope you can help me, thank you very much in advance.
–>nextjs code:

import { useForm } from 'react-hook-form';
import axios from 'axios';
import { useRouter } from 'next/router';


export default function Home() {
  const { register, handleSubmit, errors, reset } = useForm();
  const router = useRouter();
  
  async function onSubmitForm(name) {
    fetch('http://127.0.0.1:8000/pruebi/prueba', {
      method: 'POST', 
      body: JSON.stringify(name), 
      headers:{
        'Content-Type': 'application/json'
      }
    }).then(res => res.json())
    .catch(error => console.error('Error:', error))
    .then(response => console.log('Success:', response));
    }
  return (
    <div>
        <form onSubmit={handleSubmit(onSubmitForm)}>
            <input {...register("name")} type="text" name="name" required/>
            <button type="submit">Submit</button> 
        </form>
    </div>
  );
}

–>Route api code:

from fastapi import APIRouter
from starlette.responses import RedirectResponse


from model.insert_date import MongoDB


router = APIRouter()

@router.post("pruebi/prueba", name="Insert the date in mongo", tags=("consultas"))
async def insertDate(start_date):
        
        db = MongoDB.__init__(dBName="HAR", collectionName="date")
        MongoDB.InsertDate(db,start_date)
        
        response = RedirectResponse(url='http://localhost:3000/paginaGrafica')
        return response

–>Python code to upload the data to mongo:

try:
    import pymongo
    from pymongo import MongoClient
    import pandas as pd
    import json
    from datetime import date
except Exception as e:
    print("Some Modules are Missing ")


class MongoDB(object):

    def __init__(dBName=None, collectionName=None):
        
        client = MongoClient("localhost", 27017, maxPoolSize=50)

        DB = client(dBName)
        collection = DB(collectionName)
        
        return(collection)


    def InsertDate(collection,start_date):

        data = ({'start_date': start_date})
        

        collection.insert_many(data, ordered=False)
        print("All the Data has been Exported to Mongo DB Server .... ")