I like to first define the API and then write both at the same time. This is common when using GraphQL because you can use the Schema-first approach to define the GraphQL schema and then work Frontend and Backend at the same time.
With a REST API you could use something like Swagger or just define a README.md with the API endpoints.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.