# Replace project data source `PUT` `/api/v1/carve/projects/{project_id}/data-sources/{data_source_id}` Replace an existing attached data source with a new one of the same type. The replacement inherits the primary/non-primary status of the data source it replaces. Set `use_credits` to true to allow the replacement to exceed the row limit by charging credits for the overage (1 credit per 10 rows above the limit) when replacing a primary data source. Returns 422 if the account has insufficient credits. The account sheet will need to be refreshed to reflect any changes. ## Path parameters | Name | Type | Required | Description | |------|------|----------|-------------| | project_id | string | yes | — | | data_source_id | string | yes | — | ## Request body `application/json` | Field | Type | Required | Description | |-------|------|----------|-------------| | source | object | yes | The replacement data source. Must be the same type as the existing data source. | | source.type | string | yes | Source type. Currently only 'csv' is supported. | | source.id | string | yes | asset:// URI for the data source (see Assets endpoint). | | use_credits | boolean | no | When true, and the data source exceeds the project row limit, charge credits to expand the limit rather than rejecting the request. Credits are charged only for rows above the current limit at the rate of 1 credit per 10 rows. The request is rejected with 422 if the account has insufficient credits. | ## Response `200 OK` — `application/json` | Field | Type | Description | |-------|------|-------------| | id | string | — | | name | string | — | | type | string | — | | is_primary | boolean | — | | created_at | string | — | | updated_at | string | — | ## Errors | Status | Description | |--------|-------------| | 403 | Forbidden | | 404 | Not Found | | 422 | Unprocessable Entity | | 500 | Internal Server Error |