Enrich your application with users’ contact data
Empower your users to easily leverage existing relationships and streamline communications through key contact data.
Empower your users to easily leverage existing relationships and streamline communications through key contact data.
The Nylas Contacts API gives developers the ability to manage contact data to enhance user communication and collaboration.
Use a single API to connect to every contacts provider. No custom code required.
Get bi-directional sync with full CRUD (create, read, update, delete) capabilities.
Use Nylas SDKs with the language you’re most familiar with to speed up integration and reduce development effort.
With just a few lines of code, implement full CRUD capabilities and bi-directional sync.
See the docsNode.js
Ruby
Python
Java
Curl
const messages = await nylas.messages.list({
identifier,
queryParams: {
limit: 5,
}
})
require 'nylas'
nylas = Nylas::Client.new(api_key: 'API_KEY')
query_params = { limit: 5 }
messages, _ = nylas.messages.list(identifier: '<GRANT_ID>', query_params: query_params)
messages.each {|message|
puts "[#{Time.at(message[:date]).strftime("%d/%m/%Y at %H:%M:%S")}] \
#{message[:subject]}"
}
messages = nylas.messages.list(
grant_id,
query_params={
"limit": 5
}
)
import com.nylas.NylasClient;
import com.nylas.models.*;
import java.text.SimpleDateFormat;
public class ReadInbox {
public static void main(String[] args) throws NylasSdkTimeoutError, NylasApiError {
NylasClient nylas = new NylasClient.Builder("<API_KEY>").build();
ListMessagesQueryParams queryParams = new
ListMessagesQueryParams.Builder().limit(5).build();
ListResponse<Message> message = nylas.messages().list("<GRANT_ID>", queryParams);
for(Message email : message.getData()) {
String date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").
format(new java.util.Date((email.getDate() * 1000L)));
System.out.println("[" + date + "] | " + email.getSubject());
}
}
}
curl --request GET \
--url "https://api.us.nylas.com/v3/grants/GRANT_ID/messages?limit=5" \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <API_KEY_OR_ACCESS_TOKEN>' \
--header 'Content-Type: application/json'
Node.js
Ruby
Python
Java
Curl
const draft = new Draft.default(nylas, {
subject: "With Love, from Nylas",
body: "This email was sent using the Nylas email API.",
to: [{ name: "Nyla", email: "nyla@nylas.com" }],
});
const message = await draft.send();
require 'nylas'
nylas = Nylas::Client.new(
api_key: "API_KEY"
)
# Query parameters
query_params = {
calendar_id: ENV["GRANT_ID"],
limit: 5
}
events, _request_ids = nylas.events.list(identifier: ENV["GRANT_ID"],
query_params: query_params)
events.each {|event|
puts "Id: #{event[:id]} | Title: #{event[:title]}"
puts "\n"
}
draft = nylas.drafts.create()
draft.subject = 'With Love, from Nylas'
draft.body = 'This email was sent using the Nylas email API.'
draft.to = [{'name': 'Nyla', 'email': 'nyla@nylas.com')}]
message = draft.send()
import com.nylas.NylasClient;
import java.util.List;
public class read_calendar_events {
public static void main(String[] args) throws NylasSdkTimeoutError, NylasApiError {
NylasClient nylas = new NylasClient.Builder(dotenv.get("V3_TOKEN_API")).build();
ListEventQueryParams listEventQueryParams =
new ListEventQueryParams.Builder(dotenv.get("CALENDAR_ID"))
.limit(5)
.build();
List<Event> events = nylas.events().list(dotenv.get("CALENDAR_ID"),
listEventQueryParams).getData();
for (Event event : events){
System.out.print("Id: " + event.getId() + " | ");
System.out.print("Title: " + event.getTitle());
}
}
}
curl --request POST \
--url https://api.nylas.com/send \
--data '{
"subject": "From Nylas",
"to": [
{
"email": "nyla@nylas.com",
"name": "Nyla"
}
],
"from": [
{
"name": "Developer Relations",
"email": "devrel@nylas.com"
}
],
"body": "This email was sent using the Nylas email API.",
}'
Node.js
Ruby
Python
Java
Curl
async function fetchContacts(): Promise<void> {
try {
const identifier = '<GRANT_ID>'
const contacts = await nylas.contacts.list({
identifier,
queryParams: {
limit: 5,
}
})
console.log('Contacts:', contacts)
} catch (error) {
console.error('Error fetching contacts:', error)
}
}
fetchContacts();
require 'nylas'
nylas = Nylas::Client.new(
api_key: “<API_KEY”
)
query_params = {
limit: 5
}
contacts, _ = nylas.contacts.list(identifier: ENV["GRANT_ID"], query_params: query_params)
contacts.each {|contact|
puts "Name: #{contact[:given_name]} #{contact[:surname]} | " \
"Email: #{contact[:emails][0][:email]} | ID: #{contact[:id]}"
}
contacts = nylas.contacts.list(
'<GRANT_ID>',
query_params={
"limit": 5
}
)
print(contacts)
import com.nylas.NylasClient;
import com.nylas.models.*;
public class ReadAllContacts {
public static void main(String[] args) throws
NylasSdkTimeoutError, NylasApiError {
NylasClient nylas = new NylasClient.Builder("<API_KEY>").build();
ListContactsQueryParams queryParams =
new ListContactsQueryParams.Builder().
limit(5).build();
ListResponse<Contact> contacts = nylas.contacts().list(dotenv.get("GRANT_ID"),
queryParams);
for(Contact contact : contacts.getData()){
assert contact.getEmails() != null;
System.out.printf("Name: %s | Email: %s | Id: %s%n",
contact.getGivenName(),
contact.getEmails().get(0).getEmail(),
contact.getId()
);
}
}
}
curl --request POST \
--url https://api.nylas.com/contacts \
--data '{
"birthday": "2014-06-01",
"company_name": "Nylas",
"emails": [
{
"email": "nyla@nylas.com",
"type": "work"
}
],
"given_name": "Nyla",
],
"job_title": "Nylas Mascot",
"phone_numbers": [
{
"number": "1 800 GO NYLAS",
"type": "business"
}
],
"web_pages": [
{
"type": "work",
"url": "nylas.com"
}
],
}'
Response
{
"request_id": "d0c951b9-61db-4daa-ab19-cd44afeeabac",
"data": [
{
"starred": false,
"unread": true,
"folders": [
"UNREAD",
"CATEGORY_PERSONAL",
"INBOX"
],
"grant_id": "1",
"date": 1706811644,
"attachments": [
{
"id": "1",
"grant_id": "1",
"filename": "invite.ics",
"size": 2504,
"content_type": "text/calendar; charset=\"UTF-8\"; method=REQUEST"
},
{
"id": "2",
"grant_id": "1",
"filename": "invite.ics",
"size": 2504,
"content_type": "application/ics; name=\"invite.ics\"",
"is_inline": false,
"content_disposition": "attachment; filename=\"invite.ics\""
}
],
"from": [
{
"name": "Nylas DevRel",
"email": "nylasdev@nylas.com"
}
],
"id": "1",
"object": "message",
"snippet": "Send Email with Nylas APIs",
"subject": "Learn how to Send Email with Nylas APIs",
"thread_id": "1",
"to": [
{
"name": "Nyla",
"email": "nyla@nylas.com"
}
],
"created_at": 1706811644,
"body": "Learn how to send emails using the Nylas APIs!"
}
],
"next_cursor": "123"
}
{
"type": "event.created2",
"data": {
"object": {
"busy": true,
"calendar_id": "mock-name%40nylas.com",
"created_at": 1234567890,
"description": "mock description",
"hide_participants": false,
"ical_uid": "mock_uids@google.com",
"id": "mock-data-id",
"object": "event",
"owner": "Mock Owner <mock_owner@example.com>",
"organizer": {
"name": "mock organizer name",
"email": "mock_email@example.com"
},
"participants": [
{
"email": "mockParticipantsA@example.com",
"name": "mockParticipantsA",
"status": "yes"
},
{
"email": "mockParticipantsB@example.comm",
"name": "mockParticipantsB",
"status": "noreply"
}
],
"read_only": false,
"reminders": null,
"status": "confirmed",
"title": "mock_title",
"updated_at": 1234567890,
"when": {
"start_time": 1234567890,
"start_timezone": "America/Edmonton",
"end_time": 1234567890,
"end_timezone": "America/Edmonton",
"object": "timespan"
}
}
}
}
{
"request_id": "8b7b4ca5-d922-41dd-b1cd-47d96039fd03",
"data": [
{
"emails": [
{
"email": "nyla@nylas.com",
"type": "work"
}
],
"given_name": "Sam",
"grant_id": "7e7258dc-bc7f-4ce0-94ee-62fb6e318f17",
"groups": [
{
"id": "myContacts"
}
],
"id": "1",
"im_addresses": [],
"object": "contact",
"phone_numbers": [],
"physical_addresses": [],
"picture_url": "",
"surname": "Nyla",
"source": "address_book",
"web_pages": []
}
],
"next_cursor": "123"
}
Receive real-time notifications to monitor events and trigger automated workflows.
Experiment with our API with pre-configured settings in the Nylas Dashboard.
Fast-track your integration with our Node.js, Ruby, Python, Java and Kotlin SDKs.
Integrate your users’ contacts book in your application for better data management and scalability.
Easily capture contact details from emails without AI or machine learning expertise.
Pull contacts from calendar invitations and automatically add them into your users’ contact books.
Let users create, read, update, and delete contacts directly in your application.
Over 250,000 developers trust Nylas to deliver engaging contacts features their customers love.
Nylas makes it easy to build best-in-class communications experiences in your application.
Power personal, relationship-building conversations in your app.
Explore embedded emailBuild frictionless calendar views and scheduling tools directly in your application.
Explore calendar managementGet your API key and connect up to 5 accounts for free.