# Create New Data Source for User Creates a new data source for the user specified by the . Before creating a new data source, you must first create the data provider session. See the Authentication APIs for the details on how to create data provider sessions. Endpoint: POST /v1/users/{userId}/data_sources Version: 1.0 Security: serverToken ## Path parameters: - `userId` (string, required) Tidepool User ID ## Request fields (application/json): - `providerName` (string, required) Example: "dexcom" - `providerSessionId` (string, required) - `providerType` (string, required) Enum: "oauth" - `state` (string, required) State of the data source. Enum: "connected", "disconnected", "error" ## Response 200 fields (application/json): - `createdTime` (string, required) [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) / [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) timestamp _with_ timezone information Example: "2017-02-06T02:37:46Z" - `dataSetIds` (array, required) An array of data set IDs. The IDs in the array must be unique. Example: ["ce8cc5f7595575945f91fc6710db6fef"] - `earliestDataTime` (string, required) [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) / [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) timestamp _with_ timezone information Example: "2017-02-06T02:37:46Z" - `id` (string, required) Example: "c0ce05326529c6b35b0f4a568a344026" - `lastImportTime` (string, required) [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) / [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) timestamp _with_ timezone information Example: "2017-02-06T02:37:46Z" - `latestDataTime` (string, required) [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) / [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) timestamp _with_ timezone information Example: "2017-02-06T02:37:46Z" - `modifiedTime` (string) [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) / [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) timestamp _with_ timezone information Example: "2017-02-06T02:37:46Z" - `providerName` (string, required) Example: "dexcom" - `providerSessionId` (string, required) - `providerType` (string, required) Enum: "oauth" - `revision` (integer) - `state` (string, required) State of the data source. Enum: "connected", "disconnected", "error" - `userId` (string, required) String representation of a Tidepool User ID. Old style IDs are 10-digit strings consisting of only hexadeximcal digits. New style IDs are 36-digit [UUID v4](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random)) ## Response 400 fields (application/json): - `code` (integer, required) Example: 404 - `message` (string, required) Example: "Requested resources was not found" ## Response 401 fields (application/json): - `code` (integer, required) Example: 404 - `message` (string, required) Example: "Requested resources was not found" ## Response 403 fields (application/json): - `code` (integer, required) Example: 404 - `message` (string, required) Example: "Requested resources was not found" ## Response 404 fields (application/json): - `code` (integer, required) Example: 404 - `message` (string, required) Example: "Requested resources was not found"