Skip to main content


To demonstrate the usage of NewsFetch, we have created a simple API using FastAPI.

Try It Out!!

The API is deployed on Render and can be accessed at


To use Docker images refer to the Docker page.

Local Development


To install the API, first clone the repository, and navigate to the newsfetch-api directory.

Other installation instructions are the same as for the whole project and can be found here.


To start the API, first activate the virtual environment.

source venv/bin/activate

Then, make a copy of .env.sample to .env, and start the API.

This will start the API with SQLite database. To use a different database, update the DATABASE_URL in .env file. The sample API uses SQLAlchemy, and supports all databases supported by SQLAlchemy.

uvicorn fast_api.main:app --reload

This will start the API on http://localhost:8000.


The endpoints are documented with OpenAPI and can be accessed at http://localhost:8000/docs.

To populate the database with sample data, run the following command.


This will ingest data from the directory specified in the environment variable SOURCE_FOLDER to the database via the API. The API endpoint is specified in the environment variable API_ENDPOINT.

The data being ingested is expected to have the valid format that has been defined in the APIs datamodel. The datamodel can be found in the file newsfetch-api/core/ The wire format of the data is defined in the file newsfetch-core/