API
Pregnancy Calculator API
Welcome to the Pregnancy Calculator API! This API provides endpoints for calculating various aspects related to pregnancy, including the Fertility Window, Pregnancy Due Date, Pregnancy Week, and Pregnancy Weight Recommendation. With this API, you can easily integrate these calculations into your applications, websites, or any other projects.
The API caters to a wide range of programming languages, including but not limited to: C, Clojure, C#, GO, Java, JavaScript, Kotlin, Node.js, Objective-C, OCaml, PHP, PowerShell, Python, R, RapidQL, Ruby, Shell, and Swift.
Introduction
API Overview
This API provides essential endpoints for determining the Fertility Window, Pregnancy Due Date, Pregnancy Week, and Pregnancy Weight Recommendations. Perfect for integrating into health and wellness applications, websites, or any project supporting expectant mothers, this API offers valuable insights and tracking capabilities throughout the pregnancy journey.
Key Features:
Fertility Window Calculation: Calculates the fertility window based on cycle length and menstrual cycle start date, providing helpful insights for those planning pregnancy.
Pregnancy Due Date Prediction: Estimates the expected due date based on the last menstrual period or conception date, supporting confident planning and preparation.
Pregnancy Week Estimation: Estimates the current pregnancy week, based on either the last menstrual period or conception date, enabling users to track progress and milestones.
Pregnancy Weight Recommendation: Provides recommended pregnancy weight range, taking into account pre-pregnancy weight, height, and current gestational age for informed, healthy weight management.
v0.0.2 - Yay! New Features 🚀
🚀 10 new powerful endpoints added to expand reproductive and fertility-related calculations. All endpoints support both GET and POST requests.
✨ What’s New:
Sperm Analysis Calculator
Calculates total and functional sperm count using ejaculate volume, concentration, motility, vitality, and morphology.
Reverse Due Date Calculator
Estimates conception date and earliest intercourse date based on due date and optional pregnancy length.
Period Calculator
Predicts next period, future periods, and fertile window using cycle and period duration and last period date.
Pearl Index Calculator
Evaluates the effectiveness of birth control methods based on the Pearl Index and number of women using it.
IVF Pregnancy Planner
Predicts embryo transfer date, implantation date, and estimated due date based on IVF details.
Ovulation Calculator
Calculates fertile window and ovulation day based on cycle length and period start date.
IVF Due Date & Gestational Age Calculator
Determines due date and gestational age for IVF pregnancies based on transfer date and embryo age.
MCA (Middle Cerebral Artery) Calculator
Computes MCA PI (Pulsatility Index) and Z-score based on gestational age and velocity.
Bishop Score Calculator
Assesses readiness of the cervix for labor induction using multiple clinical parameters.
Trimester Calculator
Determines the current trimester, week range, and days remaining in the current trimester based on the due date.
Additional Highlights:
User-Friendly: Designed for easy integration into websites, apps, and platforms.
Accurate & Reliable: High precision in all calculations for trustworthy results.
Developer-Friendly: Simple integration with detailed documentation.
Comprehensive: Covers a range of pregnancy-related calculations for a well-rounded solution.
Endpoints
Endpoints Overview
Fertility Window
Calculates the fertility window based on cycle length and menstrual cycle start date, providing helpful insights for those planning pregnancy.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
cycle_length | int | Yes | The length of the menstrual cycle in days. |
menstrual_date | string | Yes | The date of the first day of the last menstrual period in the format 'YYYY-MM-DD'. |
Python Requests Example:
import requests url = "https://pregnancy-calculator-api.p.rapidapi.com/fw" querystring = {"cycle_length":"28","menstrual_date":"2024-09-11"} headers = { "x-rapidapi-key": "Sign Up for Key", "x-rapidapi-host": "pregnancy-calculator-api.p.rapidapi.com" } response = requests.get(url, headers=headers, params=querystring) print(response.json())
Response Example:
{ "fertility_window_end":"Sun, 29 Sep 2024 00:00:00 GMT", "fertility_window_start":"Fri, 20 Sep 2024 00:00:00 GMT" }
Pregnancy Due Date / Last Menstrual Period (LMP)
Calculates the estimated due date based on the user's last menstrual period (LMP)
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
last_period_date | string | Yes | The date of the user's last menstrual period in the format 'YYYY-MM-DD'. |
cycle_length | string | Yes | The average length of the user's menstrual cycle in days. |
Python Requests Example:
import requests url = "https://pregnancy-calculator-api.p.rapidapi.com/dd/lmp" querystring = {"last_period_date":"2024-09-11","cycle_length":"28"} headers = { "x-rapidapi-key": "Sign Up for Key", "x-rapidapi-host": "pregnancy-calculator-api.p.rapidapi.com" } response = requests.get(url, headers=headers, params=querystring) print(response.json())
Response Example:
{ "due_date": "2025-07-16", "gestational_age": "-260 days", "trimester": "first trimester" }
Pregnancy Due Date / Conception Date
Calculates the estimated due date based on the user's conception date.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
conception_date | string | Yes | The date of conception in the format 'YYYY-MM-DD' |
Python Requests Example:
import requests url = "https://pregnancy-calculator-api.p.rapidapi.com/dd/conception" querystring = {"conception_date":"2023-05-01"} headers = { "x-rapidapi-key": "Sign Up for Key", "x-rapidapi-host": "pregnancy-calculator-api.p.rapidapi.com" } response = requests.get(url, headers=headers, params=querystring) print(response.json())
Response Example:
{ "due_date": "2024-01-22", "gestational_age": "281 days", "trimester": "third trimester" }
Pregnancy Week / Last Menstrual Period (LMP)
Calculates the current week of pregnancy based on the Last Menstrual Period (LMP).
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
last_period_date | string | Yes | The date of the user's last menstrual period in the format 'YYYY-MM-DD'. |
cycle_length | string | Yes | The average length of the user's menstrual cycle in days. |
Python Requests Example:
import requests url = "https://pregnancy-calculator-api.p.rapidapi.com/pw/lmp" querystring = {"last_period_date":"2024-10-11","cycle_length":"28"} headers = { "x-rapidapi-key": "Sign Up for Key", "x-rapidapi-host": "pregnancy-calculator-api.p.rapidapi.com" } response = requests.get(url, headers=headers, params=querystring) print(response.json())
Response Example:
{ "common_symptoms": "By 6 weeks, morning sickness may worsen, and food cravings or aversions can develop.", "current_day": 4, "current_week": 6, "fetal_development": "At 6 weeks, the embryo's facial features start forming, and limb buds appear.", "milestones": "By week 4 to 7, the embryo implants itself into the uterus lining." }
Pregnancy Week / Conception Date
Calculates the estimated due date based on the user's conception date.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
conception_date | string | Yes | The date of conception in the format 'YYYY-MM-DD' |
Python Requests Example:
import requests url = "https://pregnancy-calculator-api.p.rapidapi.com/pw/conception" querystring = {"conception_date":"2024-09-11"} headers = { "x-rapidapi-key": "Sign Up for Key", "x-rapidapi-host": "pregnancy-calculator-api.p.rapidapi.com" } response = requests.get(url, headers=headers, params=querystring) print(response.json())
Response Example:
{ "common_symptoms": "By 4 weeks, symptoms can include nausea (morning sickness) and frequent urination.", "current_day": 6, "current_week": 4, "fetal_development": "At 4 weeks, the embryo is about the size of a poppy seed and has a primitive circulatory system.", "milestones": "By week 4 to 7, the embryo implants itself into the uterus lining." }
Pregnancy Weight Recommendation
Calculates the recommended weight during pregnancy based on the user's pre-pregnancy weight, height, and current gestational age.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
pre_pregnancy_weight | int | Yes | The user's pre-pregnancy weight in kilograms (kg). |
height | int | Yes | The user's height in meters (m). |
gestational_age | int | Yes | The current gestational age in weeks. |
Python Requests Example:
import requests url = "https://pregnancy-calculator-api.p.rapidapi.com/pwr" querystring = {"pre_pregnancy_weight":"60","height":"1.65","gestational_age":"20"} headers = { "x-rapidapi-key": "Sign Up for Key", "x-rapidapi-host": "pregnancy-calculator-api.p.rapidapi.com" } response = requests.get(url, headers=headers, params=querystring) print(response.json())
Response Example:
{ "recommendation_type": "weight_gain", "recommended_weight_change": "7.0 kg" }
Sperm Analysis Calculator
These endpoints calculate the Total sperm count and Functional sperm count based on the provided semen analysis parameters.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
ejaculate_volume | float | Yes | The volume of ejaculate in milliliters (mL). |
sperm_concentration | float | Yes | The sperm concentration in millions per milliliter (mln/mL).
|
morphology | float | Yes | The percentage of sperm with normal morphology. This should be a percentage value (e.g., 30 for 30%). |
motility | float | Yes | The percentage of sperm with normal motility. This should be a percentage value (e.g., 70 for 70%). |
vitality | float | Yes | The percentage of live sperm. This should be a percentage value (e.g., 85 for 85%). |
Python Requests Example:
import requests url = "https://pregnancy-calculator-api.p.rapidapi.com/sperm-analysis" querystring = {"ejaculate_volume":"2.5","sperm_concentration":"80","morphology":"30","motility":"70","vitality":"85"} headers = {"x-rapidapi-host": "pregnancy-calculator-api.p.rapidapi.com"} response = requests.get(url, headers=headers, params=querystring) print(response.json())
Response Example:
{ "functional_sperm": 35.7, "status": "success", "total_sperm": 200.0 }
Reverse Due Date Calculator
These endpoints calculate the Conception Date and the Intercourse Date based on the provided Due Date and Pregnancy Length (optional).
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
due_date | str | Yes | The due date (estimated delivery date) in YYYY-MM-DD format. |
pregnancy_length_weeks | int | Optional | The pregnancy length in weeks. The default value is 40 weeks (i.e., 280 days). |
Python Requests Example:
import requests url = "https://pregnancy-calculator-api.p.rapidapi.com/reverse-due-date" querystring = {"due_date":"2025-12-25","pregnancy_length_weeks":"40"} headers = {"x-rapidapi-host": "pregnancy-calculator-api.p.rapidapi.com"} response = requests.get(url, headers=headers, params=querystring) print(response.json())
Response Example:
{ "conception_date": "2025-03-20", "intercourse_date": "2025-03-13", "status": "success" }
Period Calculator
Predict the next period, three following periods, and fertility window based on the last period start date, cycle length, and period duration.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
last_period_start | str | Yes | First day of the last period (format: YYYY-MM-DD) |
cycle_length | int | Optional | Average cycle length in days (default: 28, range: 21–35) |
period_duration | int | Optional | Duration of period in days (default: 6, range: 3–8) |
Python Requests Example:
import requests url = "https://pregnancy-calculator-api.p.rapidapi.com/period" querystring = {"last_period_start":"2025-03-20","cycle_length":"28","period_duration":"6"} headers = {"x-rapidapi-host": "pregnancy-calculator-api.p.rapidapi.com"} response = requests.get(url, headers=headers, params=querystring) print(response.json())
Response Example:
{ "data": { "fertile_window": { "end": "2025-04-05", "ovulation_day": "2025-04-04", "start": "2025-03-27" }, "future_periods": [ { "end": "2025-05-20", "start": "2025-05-15" }, { "end": "2025-06-17", "start": "2025-06-12" }, { "end": "2025-07-15", "start": "2025-07-10" } ], "next_period": { "end": "2025-04-22", "start": "2025-04-17" } }, "status": "success" }
Pearl Index Calculator
These endpoints calculate the Pearl Index based on the provided number of women, study duration, and number of pregnancies.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
num_women | int | Yes | The total number of women included in the study. |
study_duration_months | int | Optional | The duration of the study in months. |
num_pregnancies | int | Optional | The total number of pregnancies observed in the study. |
Python Requests Example:
import requests url = "https://pregnancy-calculator-api.p.rapidapi.com/pearl-index" querystring = {"num_women":"55","study_duration_months":"3","num_pregnancies":"4"} headers = {"x-rapidapi-host": "pregnancy-calculator-api.p.rapidapi.com"} response = requests.get(url, headers=headers, params=querystring) print(response.json())
Response Example:
{ "pearl_index": 29.09, "status": "success", "summary": "This method has a Pearl Index of 29.09, indicating it is less effective ❌" }
IVF Pregnancy Planner
These endpoints help plan IVF (In Vitro Fertilization) treatments by calculating the estimated transfer date or due date based on provided inputs, such as transfer type, desired due date, or transfer schedule date.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
transfer_type | str | Yes | The type of embryo transfer. It determines the number of days to offset from the desired due date or transfer schedule date. Possible Values: "Day-3 embryo transfer" "Day-5 embryo transfer" "IVF with own eggs" "IVF with donor eggs cycle" Example: "Day-3 embryo transfer" |
desired_due_date | str | Optional | The desired due date for the pregnancy. If provided, the API will calculate the estimated transfer date. |
transfer_schedule_date | str | Optional | The scheduled transfer date for IVF. If provided, the API will calculate the estimated due date. |
Python Requests Example:
import requests url = "https://pregnancy-calculator-api.p.rapidapi.com/ivf/planner" querystring = {"transfer_type":"Day-3 embryo transfer","desired_due_date":"2026-12-01"} headers = {"x-rapidapi-host": "pregnancy-calculator-api.p.rapidapi.com"} response = requests.get(url, headers=headers, params=querystring) print(response.json())
Response Example:
{ "desired_due_date": "2026-12-01", "estimated_transfer_date": "2026-03-13", "mode": "plan_for_transfer", "status": "success", "transfer_type": "Day-3 embryo transfer" }
Ovulation Calculator
This Ovulation Calculator endpoints estimate the next three menstrual cycles’ ovulation days, fertility windows, and potential due dates (if conception occurs), based on your cycle length and last period start date.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
last_period_start | str | Yes | The start date of your last menstrual period. |
cycle_length | int | Optional | The average length (in days) of your menstrual cycle. |
Python Requests Example:
import requests url = "https://pregnancy-calculator-api.p.rapidapi.com/ovulation" querystring = {"last_period_start":"2025-04-01","cycle_length":"28"} headers = {"x-rapidapi-host": "pregnancy-calculator-api.p.rapidapi.com"} response = requests.get(url, headers=headers, params=querystring) print(response.json())
Response Example:
{ "data": [ { "cycle_number": 1, "cycle_start_date": "2025-04-01", "due_date_if_conceived": "2026-01-08", "fertility_window": { "end": "2025-04-18", "start": "2025-04-10" }, "ovulation_day": "2025-04-17" }, { "cycle_number": 2, "cycle_start_date": "2025-05-01", "due_date_if_conceived": "2026-02-07", "fertility_window": { "end": "2025-05-18", "start": "2025-05-10" }, "ovulation_day": "2025-05-17" }, { "cycle_number": 3, "cycle_start_date": "2025-05-31", "due_date_if_conceived": "2026-03-09", "fertility_window": { "end": "2025-06-17", "start": "2025-06-09" }, "ovulation_day": "2025-06-16" } ], "status": "success" }
IVF Due Date & Gestational Age
Calculate the estimated due date and gestational age for a pregnancy conceived through IVF (In Vitro Fertilization), based on the embryo transfer type, date of transfer, and pregnancy type (single, twins, triplets). This calculator handles common IVF scenarios, including Day-3 and Day-5 embryo transfers, IVF with own or donor eggs, and adjusts the due date for multiple pregnancies.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
transfer_type | str | Yes | The type of embryo transfer. It determines the number of days to offset from the desired due date or transfer schedule date. Possible Values: "Day-3 embryo transfer" "Day-5 embryo transfer" "IVF with own eggs" "IVF with donor eggs cycle" Example: "Day-3 embryo transfer" |
transfer_date | str | Yes | The embryo transfer date in YYYY-MM-DD format. |
pregnancy_type | str | Optional | Type of pregnancy. Options: "single" (default), "twins", or "triplets" |
Python Requests Example:
import requests url = "https://pregnancy-calculator-api.p.rapidapi.com/ivf-due-date" querystring = {"transfer_type":"Day-3 embryo transfer","transfer_date":"2023-09-11","pregnancy_type":"single"} headers = {"x-rapidapi-host": "pregnancy-calculator-api.p.rapidapi.com"} response = requests.get(url, headers=headers, params=querystring) print(response.json())
Response Example:
{ "data": { "due_date": "2024-04-19", "gestational_age": { "days": 6, "weeks": 84 }, "pregnancy_type": "triplets", "transfer_date": "2023-09-11", "transfer_type": "Day-3 embryo transfer" }, "status": "success" }
MCA Calculator
Assesses the risk of fetal anemia using Middle Cerebral Artery (MCA) Doppler measurements for both single and twin pregnancies, supporting metric and imperial units.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
gestational_age | int | Yes | Gestational age in weeks. • 14–40 weeks for single • 15–37 weeks for twin |
pregnancy_type | str | Yes | Type of pregnancy: 'single' or 'twin' |
mca_psv | float | Yes | MCA peak systolic velocity. |
unit | str | Optional | Measurement system: 'metric' (cm/s) or 'imperial' (in/min) |
Python Requests Example:
import requests url = "https://pregnancy-calculator-api.p.rapidapi.com/mca-calculator" querystring = {"gestational_age":"18","pregnancy_type":"single","mca_psv":"12","unit":"metric"} headers = {"x-rapidapi-host": "pregnancy-calculator-api.p.rapidapi.com"} response = requests.get(url, headers=headers, params=querystring) print(response.json())
Response Example:
{ "data": { "gestational_age": 18, "input_mca_psv": 12.0, "interpretation": "Normal fetal MCA PSV. Low risk of fetal anemia.", "median_mca_psv": 19.3, "mom": 0.62176, "pregnancy_type": "single", "unit": "metric" }, "status": "success" }
Bishop Score Calculator
Calculate the Bishop Score to help evaluate the likelihood of a successful induction of labor based on five clinical parameters.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
dilation | str | Yes | Cervical dilation in centimeters Options: "closed", "1-2", "3-4", "5+" |
effacement | str | Yes | Cervical effacement in percentage Options: "0-30%", "40-50%", "60-70%", "80%+" |
consistency | str | Yes | Cervical consistency assessed by the gynecologist Options: "firm", "moderate", "soft" |
station | str | Yes | Fetal station in labor (position of the baby's head) Options: "-3", "-2", "-1/0", "+1/+2" |
position | str | Optional | Fetal head position Option: "posterior", "mid", "anterior" |
Python Requests Example:
import requests url = "https://pregnancy-calculator-api.p.rapidapi.com/bishop-score-calculator" querystring = {"dilation":"1-2","effacement":"40-50%","consistency":"moderate","station":"-1/0","position":"mid"} headers = {"x-rapidapi-host": "pregnancy-calculator-api.p.rapidapi.com"} response = requests.get(url, headers=headers, params=querystring) print(response.json())
Response Example:
{ "data": { "interpretation": "Unfavorable cervix. Low chances of vaginal labor without ripening.", "total_score": 6 }, "status": "success" }
Trimester Calculator
Calculate the current trimester, days into the trimester, and trimester date ranges based on either the Last Menstrual Period (LMP) or the Estimated Due Date.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
lmp | str | Optional | Last Menstrual Period in YYYY-MM-DD format. |
due_date | str | Optional | Estimated due date in YYYY-MM-DD format. |
Python Requests Example:
import requests url = "https://pregnancy-calculator-api.p.rapidapi.com/trimester-calculator" querystring = {"lmp":"2024-07-01"} headers = {"x-rapidapi-host": "pregnancy-calculator-api.p.rapidapi.com"} response = requests.get(url, headers=headers, params=querystring) print(response.json())
Response Example:
{ "data": { "current_trimester": "Post-term", "days_into_trimester": 3, "days_left_in_trimester": 0, "trimester_ranges": { "First Trimester": { "end": "2024-09-29", "start": "2024-07-01" }, "Second Trimester": { "end": "2024-12-28", "start": "2024-09-30" }, "Third Trimester": { "end": "2025-04-07", "start": "2024-12-29" } } }, "status": "success" }
Subscribe to Pregnancy Calculator API
Subscribe to Pregnancy Calculator API
Subscribe to Pregnancy Calculator API
Subscribe to Pregnancy Calculator API
Your Vision, Our Expertise
from flask import Flask
app = Flask(__name__)
# Error message handler
# Main functions for the API
# Endpoints for the API
if __name__ == "__main__":
app.run()
Let Us Build Your Next Robust API
Looking for a custom API tailored to your unique needs? Whether you need automation, engagement tools, or a business solution, Dakidarts has you covered.