Skip to content

contacts

ListContactGroupsQueryParams = ListQueryParams module-attribute

The available query parameters for listing contact groups.

UpdateContactRequest = CreateContactRequest module-attribute

Interface for updating a Nylas contact.

Contact dataclass

Class representation of a Nylas contact object.

Attributes:

Name Type Description
id str

Globally unique object identifier.

grant_id str

Grant ID representing the user's account.

object str

The type of object.

birthday Optional[str]

The contact's birthday.

company_name Optional[str]

The contact's company name.

display_name Optional[str]

The contact's display name.

emails Optional[List[ContactEmail]]

The contact's email addresses.

im_addresses Optional[List[InstantMessagingAddress]]

The contact's instant messaging addresses.

given_name Optional[str]

The contact's given name.

job_title Optional[str]

The contact's job title.

manager_name Optional[str]

The contact's manager name.

middle_name Optional[str]

The contact's middle name.

nickname Optional[str]

The contact's nickname.

notes Optional[str]

The contact's notes.

office_location Optional[str]

The contact's office location.

picture_url Optional[str]

The contact's picture URL.

picture Optional[str]

The contact's picture.

suffix Optional[str]

The contact's suffix.

surname Optional[str]

The contact's surname.

source Optional[SourceType]

The contact's source.

phone_numbers Optional[List[PhoneNumber]]

The contact's phone numbers.

physical_addresses Optional[List[PhysicalAddress]]

The contact's physical addresses.

web_pages Optional[List[WebPage]]

The contact's web pages.

groups Optional[List[ContactGroupId]]

The contact's groups.

Source code in nylas/models/contacts.py
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
@dataclass_json
@dataclass
class Contact:
    """
    Class representation of a Nylas contact object.

    Attributes:
        id: Globally unique object identifier.
        grant_id: Grant ID representing the user's account.
        object: The type of object.
        birthday: The contact's birthday.
        company_name: The contact's company name.
        display_name: The contact's display name.
        emails: The contact's email addresses.
        im_addresses: The contact's instant messaging addresses.
        given_name: The contact's given name.
        job_title: The contact's job title.
        manager_name: The contact's manager name.
        middle_name: The contact's middle name.
        nickname: The contact's nickname.
        notes: The contact's notes.
        office_location: The contact's office location.
        picture_url: The contact's picture URL.
        picture: The contact's picture.
        suffix: The contact's suffix.
        surname: The contact's surname.
        source: The contact's source.
        phone_numbers: The contact's phone numbers.
        physical_addresses: The contact's physical addresses.
        web_pages: The contact's web pages.
        groups: The contact's groups.
    """

    id: str
    grant_id: str
    object: str = "contact"
    birthday: Optional[str] = None
    company_name: Optional[str] = None
    display_name: Optional[str] = None
    emails: Optional[List[ContactEmail]] = None
    im_addresses: Optional[List[InstantMessagingAddress]] = None
    given_name: Optional[str] = None
    job_title: Optional[str] = None
    manager_name: Optional[str] = None
    middle_name: Optional[str] = None
    nickname: Optional[str] = None
    notes: Optional[str] = None
    office_location: Optional[str] = None
    picture_url: Optional[str] = None
    picture: Optional[str] = None
    suffix: Optional[str] = None
    surname: Optional[str] = None
    source: Optional[SourceType] = None
    phone_numbers: Optional[List[PhoneNumber]] = None
    physical_addresses: Optional[List[PhysicalAddress]] = None
    web_pages: Optional[List[WebPage]] = None
    groups: Optional[List[ContactGroupId]] = None

ContactEmail dataclass

An email address for a contact.

Attributes:

Name Type Description
email Optional[str]

The email address.

type Optional[str]

The type of email address.

Source code in nylas/models/contacts.py
74
75
76
77
78
79
80
81
82
83
84
85
86
@dataclass_json
@dataclass
class ContactEmail:
    """
    An email address for a contact.

    Attributes:
        email: The email address.
        type: The type of email address.
    """

    email: Optional[str] = None
    type: Optional[str] = None

ContactGroup dataclass

Class representation of a Nylas contact group object.

Attributes:

Name Type Description
id str

Globally unique object identifier.

grant_id str

Grant ID representing the user's account.

object str

The type of object.

group_type Optional[GroupType]

The type of contact group.

name Optional[str]

The name of the contact group.

path Optional[str]

The path of the contact group.

Source code in nylas/models/contacts.py
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
@dataclass_json
@dataclass
class ContactGroup:
    """
    Class representation of a Nylas contact group object.

    Attributes:
        id: Globally unique object identifier.
        grant_id: Grant ID representing the user's account.
        object: The type of object.
        group_type: The type of contact group.
        name: The name of the contact group.
        path: The path of the contact group.
    """

    id: str
    grant_id: str
    object: str = "contact_group"
    group_type: Optional[GroupType] = None
    name: Optional[str] = None
    path: Optional[str] = None

ContactGroupId dataclass

A contact group ID for a contact.

Attributes:

Name Type Description
id str

The contact group ID.

Source code in nylas/models/contacts.py
89
90
91
92
93
94
95
96
97
98
99
@dataclass_json
@dataclass
class ContactGroupId:
    """
    A contact group ID for a contact.

    Attributes:
        id: The contact group ID.
    """

    id: str

CreateContactRequest

Bases: TypedDict

Interface for creating a Nylas contact.

Attributes:

Name Type Description
birthday NotRequired[str]

The contact's birthday.

company_name NotRequired[str]

The contact's company name.

display_name NotRequired[str]

The contact's display name.

emails NotRequired[List[WriteableContactEmail]]

The contact's email addresses.

im_addresses NotRequired[List[WriteableInstantMessagingAddress]]

The contact's instant messaging addresses.

given_name NotRequired[str]

The contact's given name.

job_title NotRequired[str]

The contact's job title.

manager_name NotRequired[str]

The contact's manager name.

middle_name NotRequired[str]

The contact's middle name.

nickname NotRequired[str]

The contact's nickname.

notes NotRequired[str]

The contact's notes.

office_location NotRequired[str]

The contact's office location.

picture_url NotRequired[str]

The contact's picture URL.

picture NotRequired[str]

The contact's picture.

suffix NotRequired[str]

The contact's suffix.

surname NotRequired[str]

The contact's surname.

source NotRequired[SourceType]

The contact's source.

phone_numbers NotRequired[List[WriteablePhoneNumber]]

The contact's phone numbers.

physical_addresses NotRequired[List[WriteablePhysicalAddress]]

The contact's physical addresses.

web_pages NotRequired[List[WriteableWebPage]]

The contact's web pages.

groups NotRequired[List[WriteableContactGroupId]]

The contact's groups.

Source code in nylas/models/contacts.py
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
class CreateContactRequest(TypedDict):
    """
    Interface for creating a Nylas contact.

    Attributes:
        birthday: The contact's birthday.
        company_name: The contact's company name.
        display_name: The contact's display name.
        emails: The contact's email addresses.
        im_addresses: The contact's instant messaging addresses.
        given_name: The contact's given name.
        job_title: The contact's job title.
        manager_name: The contact's manager name.
        middle_name: The contact's middle name.
        nickname: The contact's nickname.
        notes: The contact's notes.
        office_location: The contact's office location.
        picture_url: The contact's picture URL.
        picture: The contact's picture.
        suffix: The contact's suffix.
        surname: The contact's surname.
        source: The contact's source.
        phone_numbers: The contact's phone numbers.
        physical_addresses: The contact's physical addresses.
        web_pages: The contact's web pages.
        groups: The contact's groups.
    """

    birthday: NotRequired[str]
    company_name: NotRequired[str]
    display_name: NotRequired[str]
    emails: NotRequired[List[WriteableContactEmail]]
    im_addresses: NotRequired[List[WriteableInstantMessagingAddress]]
    given_name: NotRequired[str]
    job_title: NotRequired[str]
    manager_name: NotRequired[str]
    middle_name: NotRequired[str]
    nickname: NotRequired[str]
    notes: NotRequired[str]
    office_location: NotRequired[str]
    picture_url: NotRequired[str]
    picture: NotRequired[str]
    suffix: NotRequired[str]
    surname: NotRequired[str]
    source: NotRequired[SourceType]
    phone_numbers: NotRequired[List[WriteablePhoneNumber]]
    physical_addresses: NotRequired[List[WriteablePhysicalAddress]]
    web_pages: NotRequired[List[WriteableWebPage]]
    groups: NotRequired[List[WriteableContactGroupId]]

FindContactQueryParams

Bases: TypedDict

The available query parameters for finding a contact.

Attributes:

Name Type Description
profile_picture NotRequired[bool]

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.

Source code in nylas/models/contacts.py
343
344
345
346
347
348
349
350
351
352
class FindContactQueryParams(TypedDict):
    """
    The available query parameters for finding a contact.

    Attributes:
        profile_picture: 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.
    """

    profile_picture: NotRequired[bool]

GroupType

Bases: str, Enum

Enum representing the different types of contact groups.

Source code in nylas/models/contacts.py
355
356
357
358
359
360
class GroupType(str, Enum):
    """Enum representing the different types of contact groups."""

    USER = "user"
    SYSTEM = "system"
    OTHER = "other"

InstantMessagingAddress dataclass

An instant messaging address for a contact.

Attributes:

Name Type Description
im_address Optional[str]

The instant messaging address.

type Optional[str]

The type of instant messaging address.

Source code in nylas/models/contacts.py
102
103
104
105
106
107
108
109
110
111
112
113
114
@dataclass_json
@dataclass
class InstantMessagingAddress:
    """
    An instant messaging address for a contact.

    Attributes:
        im_address: The instant messaging address.
        type: The type of instant messaging address.
    """

    im_address: Optional[str] = None
    type: Optional[str] = None

ListContactsQueryParams

Bases: ListQueryParams

Interface of the query parameters for listing calendars.

Attributes:

Name Type Description
limit NotRequired[int]

The maximum number of objects to return. This field defaults to 50. The maximum allowed value is 200.

page_token NotRequired[str]

An identifier that specifies which page of data to return. This value should be taken from a ListResponse object's next_cursor parameter.

email NotRequired[str]

Returns the contacts matching the exact contact's email.

phone_number NotRequired[str]

Returns the contacts matching the contact's exact phone number

source NotRequired[SourceType]

Returns the contacts matching from the address book or auto-generated contacts from emails. For example of contacts only from the address book: /contacts?source=address_bookor for only autogenerated contacts:/contacts?source=inbox`

group NotRequired[str]

Returns the contacts belonging to the Contact Group matching this ID

recurse NotRequired[bool]

When set to true, returns the contacts also within the specified Contact Group subgroups, if the group parameter is set.

Source code in nylas/models/contacts.py
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
class ListContactsQueryParams(ListQueryParams):
    """
    Interface of the query parameters for listing calendars.

    Attributes:
        limit (NotRequired[int]): The maximum number of objects to return.
            This field defaults to 50. The maximum allowed value is 200.
        page_token (NotRequired[str]): An identifier that specifies which page of data to return.
            This value should be taken from a ListResponse object's next_cursor parameter.
        email: Returns the contacts matching the exact contact's email.
        phone_number: Returns the contacts matching the contact's exact phone number
        source: Returns the contacts matching from the address book or auto-generated contacts from emails.
            For example of contacts only from the address book: /contacts?source=address_bookor
            for only autogenerated contacts:/contacts?source=inbox`
        group: Returns the contacts belonging to the Contact Group matching this ID
        recurse: When set to true, returns the contacts also within the specified Contact Group subgroups,
            if the group parameter is set.
    """

    email: NotRequired[str]
    phone_number: NotRequired[str]
    source: NotRequired[SourceType]
    group: NotRequired[str]
    recurse: NotRequired[bool]

PhoneNumber dataclass

A phone number for a contact.

Attributes:

Name Type Description
number Optional[str]

The phone number.

type Optional[str]

The type of phone number.

Source code in nylas/models/contacts.py
19
20
21
22
23
24
25
26
27
28
29
30
31
@dataclass_json
@dataclass
class PhoneNumber:
    """
    A phone number for a contact.

    Attributes:
        number: The phone number.
        type: The type of phone number.
    """

    number: Optional[str] = None
    type: Optional[str] = None

PhysicalAddress dataclass

A physical address for a contact.

Attributes:

Name Type Description
format Optional[str]

The format of the address.

street_address Optional[str]

The street address of the contact.

city Optional[str]

The city of the contact.

postal_code Optional[str]

The postal code of the contact.

state Optional[str]

The state of the contact.

country Optional[str]

The country of the contact.

type Optional[str]

The type of address.

Source code in nylas/models/contacts.py
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
@dataclass_json
@dataclass
class PhysicalAddress:
    """
    A physical address for a contact.

    Attributes:
        format: The format of the address.
        street_address: The street address of the contact.
        city: The city of the contact.
        postal_code: The postal code of the contact.
        state: The state of the contact.
        country: The country of the contact.
        type: The type of address.
    """

    format: Optional[str] = None
    street_address: Optional[str] = None
    city: Optional[str] = None
    postal_code: Optional[str] = None
    state: Optional[str] = None
    country: Optional[str] = None
    type: Optional[str] = None

SourceType

Bases: str, Enum

Enum representing the different types of sources for a contact.

Source code in nylas/models/contacts.py
11
12
13
14
15
16
class SourceType(str, Enum):
    """Enum representing the different types of sources for a contact."""

    ADDRESS_BOOK = "address_book"
    INBOX = "inbox"
    DOMAIN = "domain"

WebPage dataclass

A web page for a contact.

Attributes:

Name Type Description
url Optional[str]

The URL of the web page.

type Optional[str]

The type of web page.

Source code in nylas/models/contacts.py
59
60
61
62
63
64
65
66
67
68
69
70
71
@dataclass_json
@dataclass
class WebPage:
    """
    A web page for a contact.

    Attributes:
        url: The URL of the web page.
        type: The type of web page.
    """

    url: Optional[str] = None
    type: Optional[str] = None

WriteableContactEmail

Bases: TypedDict

An email address for a contact.

Attributes:

Name Type Description
email NotRequired[str]

The email address.

type NotRequired[str]

The type of email address.

Source code in nylas/models/contacts.py
225
226
227
228
229
230
231
232
233
234
235
class WriteableContactEmail(TypedDict):
    """
    An email address for a contact.

    Attributes:
        email: The email address.
        type: The type of email address.
    """

    email: NotRequired[str]
    type: NotRequired[str]

WriteableContactGroupId

Bases: TypedDict

A contact group ID for a contact.

Attributes:

Name Type Description
id str

The contact group ID.

Source code in nylas/models/contacts.py
238
239
240
241
242
243
244
245
246
class WriteableContactGroupId(TypedDict):
    """
    A contact group ID for a contact.

    Attributes:
        id: The contact group ID.
    """

    id: str

WriteableInstantMessagingAddress

Bases: TypedDict

An instant messaging address for a contact.

Attributes:

Name Type Description
im_address NotRequired[str]

The instant messaging address.

type NotRequired[str]

The type of instant messaging address.

Source code in nylas/models/contacts.py
249
250
251
252
253
254
255
256
257
258
259
class WriteableInstantMessagingAddress(TypedDict):
    """
    An instant messaging address for a contact.

    Attributes:
        im_address: The instant messaging address.
        type: The type of instant messaging address.
    """

    im_address: NotRequired[str]
    type: NotRequired[str]

WriteablePhoneNumber

Bases: TypedDict

A phone number for a contact.

Attributes:

Name Type Description
number NotRequired[str]

The phone number.

type NotRequired[str]

The type of phone number.

Source code in nylas/models/contacts.py
176
177
178
179
180
181
182
183
184
185
186
class WriteablePhoneNumber(TypedDict):
    """
    A phone number for a contact.

    Attributes:
        number: The phone number.
        type: The type of phone number.
    """

    number: NotRequired[str]
    type: NotRequired[str]

WriteablePhysicalAddress

Bases: TypedDict

A physical address for a contact.

Attributes:

Name Type Description
format NotRequired[str]

The format of the address.

street_address NotRequired[str]

The street address of the contact.

city NotRequired[str]

The city of the contact.

postal_code NotRequired[str]

The postal code of the contact.

state NotRequired[str]

The state of the contact.

country NotRequired[str]

The country of the contact.

type NotRequired[str]

The type of address.

Source code in nylas/models/contacts.py
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
class WriteablePhysicalAddress(TypedDict):
    """
    A physical address for a contact.

    Attributes:
        format: The format of the address.
        street_address: The street address of the contact.
        city: The city of the contact.
        postal_code: The postal code of the contact.
        state: The state of the contact.
        country: The country of the contact.
        type: The type of address.
    """

    format: NotRequired[str]
    street_address: NotRequired[str]
    city: NotRequired[str]
    postal_code: NotRequired[str]
    state: NotRequired[str]
    country: NotRequired[str]
    type: NotRequired[str]

WriteableWebPage

Bases: TypedDict

A web page for a contact.

Attributes:

Name Type Description
url NotRequired[str]

The URL of the web page.

type NotRequired[str]

The type of web page.

Source code in nylas/models/contacts.py
212
213
214
215
216
217
218
219
220
221
222
class WriteableWebPage(TypedDict):
    """
    A web page for a contact.

    Attributes:
        url: The URL of the web page.
        type: The type of web page.
    """

    url: NotRequired[str]
    type: NotRequired[str]