# Return a contact

> **GET** `https://api.us.nylas.com/v3/grants/{grant_id}/contacts/{contact_id}`

Source: https://developer.nylas.com/docs/reference/api/contacts/get-contact/

Return a contact by ID.

**Authentication:** NYLAS_API_KEY, ACCESS_TOKEN

## Parameters

### Query parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `select` | string | No | Specify fields that you want Nylas to return, as a comma-separated list (for example, `select=id,updated_at`). This allows you to receive only the portion of object data that you're interested in. You can use `select` to optimize response size and reduce latency by limiting queries to only the information that you need. |
| `profile_picture` | boolean | No | If `true` and `picture_url` is present, the response includes a Base64 binary data blob that you can use to view information as an image file (for example, a JPEG). |

### Path parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `grant_id` | string | Yes | ID of the grant to access. Use `/me/` to refer to the grant associated with an access token. |
| `contact_id` | string | Yes | ID of the contact to access. Nylas recommends you URL-encode this field, or you might receive a [`404` error](/docs/api/errors/400-response/) if the ID contains special characters (for example, `#`). |

## Responses

### 200 - Contact

- `request_id` (string) - The request ID.
- `data` (object)
  - `birthday` (string) - The contact's birthday in [ISO-8601 format](https://en.wikipedia.org/wiki/ISO_8601#Calendar_dates).
  - `company_name` (string) - The name of the company that the contact is affiliated with (for example, their workplace).
  - `emails` (array,null) - The contact's email addresses. May be `null` if the contact has no email addresses. Treat `null` the same as an empty array.
  - `given_name` (string) - The contact's given name.
  - `grant_id` (string) - The ID of grant for the connected user.
  - `groups` (array,null) - The contact's group memberships. May be `null` if the contact has no group memberships. Treat `null` the same as an empty array.
  - `id` (string) - A globally unique object identifier for Microsoft accounts. An email address for Google accounts.
  - `im_addresses` (array,null) - The contact's IM addresses. May be `null` if the contact has no IM addresses. Treat `null` the same as an empty array.
  - `job_title` (string) - The contact's occupation or job title.
  - `manager_name` (string) - The name of the contact's manager.
  - `middle_name` (string) - The contact's middle name.
  - `nickname` (string) - A custom nickname for the contact.
  - `notes` (string) - Notes about with the contact (for example, their favorite food).
  - `object` (string) - The response object type.
  - `office_location` (string) - The location of the office where the contact works.
  - `phone_numbers` (array,null) - The contact's phone numbers. May be `null` if the contact has no phone numbers. Treat `null` the same as an empty array.
  - `physical_addresses` (array,null) - The contact's physical addresses. May be `null` if the contact has no physical addresses. Treat `null` the same as an empty array.
  - `picture_url` (string) - A URL that links to the contact's picture.
  - `source` (string) - The source of the contact. For iCloud and IMAP grants, the source is `inbox` if the contact is 
parsed from a message. If the contact is created or updated using the Nylas API, its source is 
`address_book`.
  - `suffix` (string) - (Not supported for EWS) The suffix of a contact's name, if applicable.
  - `surname` (string) - The contact's surname.
  - `web_pages` (array,null) - The contact's web pages. May be `null` if the contact has no web pages. Treat `null` the same as an empty array.
  - `picture` (string) - The contact's picture, represented as a Base64-encoded string.

### 400 - Bad Request

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.
  - `provider_error` (object) - The error from the provider.

### 401 - Unauthorized

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.
  - `provider_error` (object) - The error from the provider.

### 404 - Not Found

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.
  - `provider_error` (object) - The raw error from the provider, if available
    - `code` (string)
    - `message` (string)

### 429 - Rate Limit

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.

### 504 - Provider Failure

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.

## Code samples

### cURL

```bash
curl --compressed --request GET \
  --url 'https://api.us.nylas.com/v3/grants/<NYLAS_GRANT_ID>/contacts/<CONTACT_ID>' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer <NYLAS_API_KEY>' \
  --header 'Content-Type: application/json'
```

### Node.js SDK

```javascript
import Nylas from "nylas";

const nylas = new Nylas({
  apiKey: "<NYLAS_API_KEY>",
  apiUri: "<NYLAS_API_URI>",
});

async function fetchContactById() {
  try {
    const contact = await nylas.contacts.find({
      identifier: "<NYLAS_GRANT_ID>",
      contactId: "<CONTACT_ID>",
      queryParams: {},
    });

    console.log("contact:", contact);
  } catch (error) {
    console.error("Error fetching contact:", error);
  }
}

fetchContactById();

```

### Python SDK

```python
from nylas import Client

nylas = Client(
    "<NYLAS_API_KEY>",
    "<NYLAS_API_URI>"
)

grant_id = "<NYLAS_GRANT_ID>"
contact_id = "<CONTACT_ID>"

contact = nylas.contacts.find(
  grant_id,
  contact_id,
)

print(contact)
```

### Ruby SDK

```ruby
require 'nylas'	

nylas = Nylas::Client.new(api_key: "<NYLAS_API_KEY>")
contact, _ = nylas.contacts.find(identifier: "<NYLAS_GRANT_ID>", contact_id: "<CONTACT_ID>")

puts contact
```

### Java SDK

```java
import com.nylas.NylasClient;
import com.nylas.models.*;

public class ReturnAContact {
  public static void main(String[] args) throws NylasSdkTimeoutError, NylasApiError {
    NylasClient nylas = new NylasClient.Builder("<NYLAS_API_KEY>").build();
    Response<Contact> contact = nylas.contacts().find("<NYLAS_GRANT_ID>", "<CONTACT_ID>");

    System.out.println(contact);
  }
}

```

### Kotlin SDK

```kotlin
import com.nylas.NylasClient

fun main(args: Array<String>) {
  val nylas: NylasClient = NylasClient(apiKey = "<NYLAS_API_KEY>")
  var contact = nylas.contacts().find("<NYLAS_GRANT_ID>", "<CONTACT_ID>")

  print(contact)
}

```
