javascript – POST 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('', {
      method: 'POST', 
      body: JSON.stringify(name), 
        'Content-Type': 'application/json'
    }).then(res => res.json())
    .catch(error => console.error('Error:', error))
    .then(response => console.log('Success:', response));
  return (
        <form onSubmit={handleSubmit(onSubmitForm)}>
            <input {...register("name")} type="text" name="name" required/>
            <button type="submit">Submit</button> 

–>Route api code:

from fastapi import APIRouter
from starlette.responses import RedirectResponse

from model.insert_date import MongoDB

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

–>Python code to upload the data to mongo:

    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)

    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 .... ")