Since an endoscopy allows a doctor to visually inspect the upper digestive tract the procedure may help identify any additional damage to the tract that may not have been detected otherwise.Biopsy: a small sample of tissue from the oesophagus is removed. It is then studied to check for inflammation, cancer, or other problems. Treatment
Treatment plans are tailored to the specific diagnosis and etiology of the heartburn. Management of heartburn can be sorted into various categories. Pharmacologic management
Antacids (i.e. calcium carbonate) are often taken to treat the immediate problem
H2 receptor antagonists or proton pump inhibitors are effective for the two most common causes of heartburn (e.g. gastritis and GERD)
Antibiotics are used if H. pylori is present. Behavioral management
Taking medications 30–45 minutes before eating suppresses the stomachs acid generating response to food
Avoiding spicy foods, foods high in fats, peppermint, and chocolate
Avoiding reclining 2.5–3.5 hours after a meal to prevent the reflux of stomachs contents

Lifestyle modifications
Early studies show that diets that are high in fiber may show evidence in decreasing symptoms of dyspepsia. Weight loss can decrease abdominal pressure that both delays gastric emptying and increases gastric acid reflux into the esophagus

Alternative and complementary therapies
Symptoms of heartburn may not always be the result of an organic cause. Patients may respond better to therapies targeting anxiety and symptoms of hyper-vigilance, through medications aimed towards a psychiatric etiology, osteopathic manipulation and acupuncture. Psychotherapy may show a positive role in treatment of heartburn and the reduction of distress experienced during symptoms. Acupuncture - in cases of functional heartburn (e.g.
Hormonal – related to the increasing amounts of estrogen and progesterone and their effect on the LES
Mechanical – the enlarging uterus increasing intra-abdominal pressure, inducing reflux of gastric acid
Behavioral – as with other instances of heartburn, behavioral modifications can exacerbate or alleviate symptoms

Unknown origin
Functional heartburn is heartburn of unknown cause. It is commonly associated with psychiatric conditions like depression, anxiety, and panic attacks. It is also seen with other functional gastrointestinal disorders like irritable bowel syndrome and is the primary cause of lack of improvement post treatment with proton pump inhibitors (PPIs). Despite this, PPIs are still the primary treatment with response rates in about 50% of people. The diagnosis is one of elimination, based upon the Rome III criteria. It was found to be present in 22.3% of Canadians in one survey. Diagnostic approach
Heartburn can be caused by several conditions and a preliminary diagnosis of GERD is based on additional signs and symptoms. The chest pain caused by GERD has a distinct burning sensation, occurs after eating or at night, and worsens when a person lies down or bends over. It also is common in pregnant women, and may be triggered by consuming food in large quantities, or specific foods containing certain spices, high fat content, or high acid content. In young persons (typically <40 years) who present with heartburn symptoms consistent with GERD (onset after eating, when laying down, when pregnant), a physician may begin a course of PPIs to assess clinical improvement before additional testing is undergone.