---
title: Wellbore
slug: wellbore
docTags: 
createdAt: 2023-03-22T19:15:35.000Z
---

A wellbore is a borehole drilled from the surface into the subsurface reservoir formation. Every well has at least one wellbore. A well may have additional wellbores sidetracked from the main bore; each child wellbore joins its parent at a measured depth called the junction depth. The main wellbore has no junction depth (**junctionMd** is NULL); for child wellbores, **junctionMd** must be a positive number (e.g. 2000 ft).

The unique constraint on wellbores is **sourceWellId + sourceId**.

:::hint{type="warning"}
A [Well](docId\:P-xHbe4jqKJQemay7aOL5) record with the corresponding **sourceWellId** must exist before adding a wellbore.
:::

| **Variable** | **Data Type** | **Unit of Measure** | **Is Nullable?** | **Default Value** | **Description**                                                                                                                                          |
| ------------ | ------------- | ------------------- | ---------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| sourceId     | String        | -                   | No               | -                 | Source ID for the wellbore<br /><br />**From WellView:** wvwellbore table, idrec column<br />**From OpenWells:** cd\_wellbore table, wellbore\_id column |
| sourceWellId | String        | -                   | No               | -                 | Source ID for the well<br /><br />**From WellView:** wvwellbore table, idwell column<br />**From OpenWells:** cd\_wellbore table, well\_id column        |
| name         | String        | -                   | Yes              | -                 | Name of the wellbore                                                                                                                                     |
| junctionMd   | Double        | ft                  | Yes              | -                 | Measured depth at which a child wellbore joins its parent. NULL for the main wellbore.                                                                   |

***

# Data Integrity Checks

| **Condition**                                 | **Response**    |
| --------------------------------------------- | --------------- |
| sourceId or sourceWellId is NULL or empty     | Record Rejected |
| sourceWellId does not exist in the Well table | Record Rejected |

***

# Common Error Messages

| **API**               | **Scenario**         | **Error Response**                      |
| --------------------- | -------------------- | --------------------------------------- |
| Add / Upsert wellbore | Unknown sourceWellId | well with source id: xxx does not exist |
