Method: people.createContact
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\u003eCreates a new contact and returns the person resource.\u003c/p\u003e\n"],["\u003cp\u003eReturns a 400 error if singleton fields (biographies, birthdays, genders, names) have more than one value specified.\u003c/p\u003e\n"],["\u003cp\u003eRequires sequential mutate requests for the same user to avoid latency and failures.\u003c/p\u003e\n"],["\u003cp\u003eUses the \u003ccode\u003epersonFields\u003c/code\u003e and \u003ccode\u003esources[]\u003c/code\u003e query parameters to control data returned.\u003c/p\u003e\n"],["\u003cp\u003eRequires the \u003ccode\u003ehttps://www.googleapis.com/auth/contacts\u003c/code\u003e OAuth scope for authorization.\u003c/p\u003e\n"]]],["This content outlines how to create a new contact using the Google People API. A `POST` request is sent to `https://people.googleapis.com/v1/people:createContact`. The request body should include a `Person` resource, and the response will return the created `Person`. Required query parameters include `personFields`, which specifies the data to return, and optionally `sources[]` to limit data sources. Only one field is allowed for `biographies`, `birthdays`, `genders`, and `names`. Sequential requests are recommended for multiple updates to the same user. It requires `https://www.googleapis.com/auth/contacts` authorization scope.\n"],null,["# Method: people.createContact\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nCreate a new contact and return the person resource for that contact.\n\nThe request returns a 400 error if more than one field is specified on a field that is a singleton for contact sources:\n\n- biographies\n- birthdays\n- genders\n- names\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:createContact`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Query parameters\n\n| Parameters ||\n|----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `personFields` | `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. Multiple fields can be specified by separating them with commas. Defaults to all fields if not set. 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. 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### Request body\n\nThe request body contains an instance of [Person](/people/api/rest/v1/people#Person).\n\n### Response body\n\nIf successful, the response body contains an instance of [Person](/people/api/rest/v1/people#Person).\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)."]]