> ## Documentation Index
> Fetch the complete documentation index at: https://dev.ownright.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Referral

> Returns a referral.

<RequestExample>
  ```graphql Request [expandable] theme={null}
  query GetReferral($id: ReferralGID!) {
    referral(id: $id) {
      createdAt
      id
      status
      type
      updatedAt
      contacts {
        email
        firstName
        id
        isPrimary
        lastName
        phoneNumber
      }
      customAttributes {
        id
        key
        type
        value
      }
      primaryContact {
        email
        firstName
        id
        isPrimary
        lastName
        phoneNumber
      }
      ... on PurchasePropertyClosingReferral {
        propertyAddress {
          city
          country
          latitude
          longitude
          mapImageUrl
          postalCode
          province
          shortTitle
          street
          title
          unitNumber
        }
        purchaseAmount {
          amount
          currencyCode
        }
      }
      ... on RefinanceReferral {
        mortgageAmount {
          amount
          currencyCode
        }
        propertyAddress {
          city
          country
          latitude
          longitude
          mapImageUrl
          postalCode
          province
          shortTitle
          street
          title
          unitNumber
        }
      }
      ... on SalePropertyClosingReferral {
        propertyAddress {
          city
          country
          latitude
          longitude
          mapImageUrl
          postalCode
          province
          shortTitle
          street
          title
          unitNumber
        }
      }
    }
  }
  ```

  ```graphql Variables theme={null}
  {
    "id": "gid://ownright/Referral/1"
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "data": {
      "referral": {
        "createdAt": "2025-01-15T10:30:00Z",
        "id": "gid://ownright/Object/1",
        "status": "CONVERTED",
        "type": "PURCHASE_PROPERTY_CLOSING",
        "updatedAt": "2025-01-15T10:30:00Z",
        "contacts": [
          {
            "email": "jane@example.com",
            "firstName": "Jane",
            "id": "gid://ownright/Object/1",
            "isPrimary": true,
            "lastName": "Doe",
            "phoneNumber": "+14165551234"
          }
        ],
        "customAttributes": [
          {
            "id": "gid://ownright/Object/1",
            "key": "example-key",
            "type": "BOOLEAN",
            "value": "example-value"
          }
        ],
        "primaryContact": {
          "email": "jane@example.com",
          "firstName": "Jane",
          "id": "gid://ownright/Object/1",
          "isPrimary": true,
          "lastName": "Doe",
          "phoneNumber": "+14165551234"
        },
        "propertyAddress": {
          "city": "Toronto",
          "country": "CANADA",
          "latitude": 1,
          "longitude": 1,
          "mapImageUrl": "https://example.com",
          "postalCode": "M5V 1A1",
          "province": "ALBERTA",
          "shortTitle": "123 Main St, Toronto",
          "street": "123 Main St",
          "title": "123 Main St, Toronto",
          "unitNumber": "Suite 100"
        },
        "purchaseAmount": {
          "amount": "100.00",
          "currencyCode": "CAD"
        },
        "mortgageAmount": {
          "amount": "100.00",
          "currencyCode": "CAD"
        }
      }
    }
  }
  ```
</ResponseExample>

## Query field

`referral`

### Arguments

<ParamField path="id" type="ReferralGID!" required>
  The identifier of the referral to find.
</ParamField>

### Return fields

<ResponseField name="referral" type="Referral">
  Returns a referral.

  <Expandable title="properties">
    <ResponseField name="contacts" type="[ReferralContact!]!" required>
      The contacts for the referral.

      <Expandable title="properties">
        <ResponseField name="email" type="String!" required>
          The email of the contact.
        </ResponseField>

        <ResponseField name="firstName" type="String!" required>
          The first name of the contact.
        </ResponseField>

        <ResponseField name="id" type="GID!" required>
          ID of the object.
        </ResponseField>

        <ResponseField name="isPrimary" type="Boolean!" required>
          Whether the contact is the primary contact.
        </ResponseField>

        <ResponseField name="lastName" type="String">
          The last name of the contact.
        </ResponseField>

        <ResponseField name="phoneNumber" type="String">
          The phone number of the contact.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="createdAt" type="ISO8601DateTime!" required>
      The time the referral was created.
    </ResponseField>

    <ResponseField name="customAttributes" type="[CustomAttribute!]!" required>
      The custom attributes for the referral.

      <Expandable title="properties">
        <ResponseField name="id" type="GID!" required>
          ID of the object.
        </ResponseField>

        <ResponseField name="key" type="String!" required>
          The key of the custom attribute.
        </ResponseField>

        <ResponseField name="type" type="CustomAttributeType!" required>
          The type of the custom attribute.
        </ResponseField>

        <ResponseField name="value" type="String!" required>
          The value of the custom attribute.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="id" type="GID!" required>
      ID of the object.
    </ResponseField>

    <ResponseField name="primaryContact" type="ReferralContact!" required>
      The primary contact for the referral.

      <Expandable title="properties">
        <ResponseField name="email" type="String!" required>
          The email of the contact.
        </ResponseField>

        <ResponseField name="firstName" type="String!" required>
          The first name of the contact.
        </ResponseField>

        <ResponseField name="id" type="GID!" required>
          ID of the object.
        </ResponseField>

        <ResponseField name="isPrimary" type="Boolean!" required>
          Whether the contact is the primary contact.
        </ResponseField>

        <ResponseField name="lastName" type="String">
          The last name of the contact.
        </ResponseField>

        <ResponseField name="phoneNumber" type="String">
          The phone number of the contact.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="status" type="ReferralStatus!" required>
      The current status of the referral.
    </ResponseField>

    <ResponseField name="type" type="ReferralType!" required>
      The type of the referral.
    </ResponseField>

    <ResponseField name="updatedAt" type="ISO8601DateTime!" required>
      The time the referral was updated.
    </ResponseField>
  </Expandable>
</ResponseField>

### Types

* [`CustomAttribute`](/partner-api/reference/members/objects/custom-attribute) (object) — A custom attribute.
* [`CustomAttributeType`](/partner-api/reference/members/enums/custom-attribute-type) (enum) — Possible custom attribute types.
* [`GID`](/partner-api/reference/members/scalars/gid) (scalar) — A global identifier for an object in the format of 'gid://ownright/ObjectType/ID'.
* [`ISO8601DateTime`](/partner-api/reference/members/scalars/iso8601-date-time) (scalar) — An ISO 8601-encoded datetime
* [`Referral`](/partner-api/reference/members/interfaces/referral) (interface) — Represents a referral.
* [`ReferralContact`](/partner-api/reference/members/objects/referral-contact) (object) — A contact for a referral.
* [`ReferralGID`](/partner-api/reference/members/scalars/referral-gid) (scalar) — A global identifier for a Referral object in format of 'gid://ownright/Referral/ID'.
* [`ReferralStatus`](/partner-api/reference/members/enums/referral-status) (enum) — Possible statuses for referrals.
* [`ReferralType`](/partner-api/reference/members/enums/referral-type) (enum) — Possible types of referrals.
