Method: people.batchCreateContacts
Stay organized with collections
Save and categorize content based on your preferences.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-08-06 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-06 UTC."],[[["\u003cp\u003eCreate up to 200 new contacts in a single batch request and receive PersonResponses for successful entries.\u003c/p\u003e\n"],["\u003cp\u003eSpecify a \u003ccode\u003ereadMask\u003c/code\u003e to control the fields returned for each created contact or leave it empty to skip the post-mutate-get.\u003c/p\u003e\n"],["\u003cp\u003eUtilize the \u003ccode\u003eContactToCreate\u003c/code\u003e object to define the person data for each new contact within the batch.\u003c/p\u003e\n"],["\u003cp\u003eRequires authorization with the \u003ccode\u003ehttps://www.googleapis.com/auth/contacts\u003c/code\u003e scope.\u003c/p\u003e\n"],["\u003cp\u003eSequential requests for the same user are recommended to optimize performance and reliability.\u003c/p\u003e\n"]]],["This documentation outlines the process of creating multiple contacts via a batch request. Using a `POST` request to `https://people.googleapis.com/v1/people:batchCreateContacts`, up to 200 `ContactToCreate` objects can be sent in the request body's `contacts` array. A `readMask` is required to specify which fields to return, and optional `sources` specify which source types to return. Successful requests return an array of `createdPeople` which contain the contacts that were created.\n"],null,["# Method: people.batchCreateContacts\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n - [JSON representation](#body.BatchCreateContactsResponse.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n- [ContactToCreate](#ContactToCreate)\n - [JSON representation](#ContactToCreate.SCHEMA_REPRESENTATION)\n- [Try it!](#try-it)\n\nCreate a batch of new contacts and return the PersonResponses for the newly\n\nMutate requests for the same user should be sent sequentially to avoid increased latency and failures.\n\n### HTTP request\n\n`POST https://people.googleapis.com/v1/people:batchCreateContacts`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Request body\n\nThe request body contains data with the following structure:\n\n| JSON representation |\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"contacts\": [ { object (/people/api/rest/v1/people/batchCreateContacts#ContactToCreate) } ], \"readMask\": string, \"sources\": [ enum (/people/api/rest/v1/ReadSourceType) ] } ``` |\n\n| Fields ||\n|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `contacts[]` | `object (`[ContactToCreate](/people/api/rest/v1/people/batchCreateContacts#ContactToCreate)`)` Required. The contact to create. Allows up to 200 contacts in a single request. |\n| `readMask` | `string (`[FieldMask](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask)` format)` Required. A field mask to restrict which fields on each person are returned in the response. Multiple fields can be specified by separating them with commas. If read mask is left empty, the post-mutate-get is skipped and no data will be returned in the response. Valid values are: - addresses - ageRanges - biographies - birthdays - calendarUrls - clientData - coverPhotos - emailAddresses - events - externalIds - genders - imClients - interests - locales - locations - memberships - metadata - miscKeywords - names - nicknames - occupations - organizations - phoneNumbers - photos - relations - sipAddresses - skills - urls - userDefined |\n| `sources[]` | `enum (`[ReadSourceType](/people/api/rest/v1/ReadSourceType)`)` Optional. A mask of what source types to return in the post mutate read. Defaults to [READ_SOURCE_TYPE_CONTACT](/people/api/rest/v1/ReadSourceType#ENUM_VALUES.READ_SOURCE_TYPE_CONTACT) and [READ_SOURCE_TYPE_PROFILE](/people/api/rest/v1/ReadSourceType#ENUM_VALUES.READ_SOURCE_TYPE_PROFILE) if not set. |\n\n### Response body\n\nIf not successful, returns [BatchCreateContactsErrorDetails](/people/api/rest/v1/BatchCreateContactsErrorDetails) which contains a list of errors for each invalid contact.\n\nThe response to a request to create a batch of contacts.\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|----------------------------------------------------------------------------------|\n| ``` { \"createdPeople\": [ { object (/people/api/rest/v1/PersonResponse) } ] } ``` |\n\n| Fields ||\n|-------------------|-------------------------------------------------------------------------------------------------------------------------------------------|\n| `createdPeople[]` | `object (`[PersonResponse](/people/api/rest/v1/PersonResponse)`)` The contacts that were created, unless the request `readMask` is empty. |\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/contacts`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent).\n\nContactToCreate\n---------------\n\nA wrapper that contains the person data to populate a newly created source.\n\n| JSON representation |\n|-----------------------------------------------------------------------------|\n| ``` { \"contactPerson\": { object (/people/api/rest/v1/people#Person) } } ``` |\n\n| Fields ||\n|-----------------|------------------------------------------------------------------------------------------------------------------------|\n| `contactPerson` | `object (`[Person](/people/api/rest/v1/people#Person)`)` Required. The person data to populate a newly created source. |"]]