> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://reference.flatfile.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://reference.flatfile.com/_mcp/server.

# Add Records To Clip

POST https://api.x.flatfile.com/v1/data-clips/{dataClipId}/add-records
Content-Type: application/json

Adds records to an existing DataClip.

Reference: https://reference.flatfile.com/api-reference/data-clips/add-records-to-clip

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `dataClipId` (string, required) — Data Clip ID

### Body (application/json)

This endpoint expects an AddRecordsToClipRequest.

- `recordIds` (list of string, required)

## Response

### 200

- `success` (boolean, required)
- `commitId` (string, optional) — Commit ID
- `counts` (RecordCounts, optional)
- `records` (list of RecordWithLinks, optional) — List of Record objects, including links to related rows
- `versionId` (string, optional, deprecated) — Deprecated, use `commitId` instead.

## Errors

### 400 Bad Request Error

- `errors` (list of Error, required)

### 404 Not Found Error

- `errors` (list of Error, required)

## Types

### RecordCounts

- `total` (integer, required)
- `valid` (integer, required)
- `error` (integer, required)
- `byField` (map from string to FieldRecordCounts, optional) — Counts for valid, error, and total records grouped by field key
- `errorsByField` (map from string to integer, optional, deprecated)

### RecordWithLinks

A single row of data in a Sheet, including links to related rows

- `id` (string, required) — Record ID
- `values` (map from string to CellValueWithLinks, required) — A single row of data in a Sheet, including links to related rows
- `valid` (boolean, optional)
- `messages` (list of ValidationMessage, optional)
- `metadata` (map from string to any, optional)
- `config` (RecordConfig, optional) — Configuration of a record or specific fields in the record

### Error

- `message` (string, required)
- `key` (string, optional)

### FieldRecordCounts

- `total` (integer, required)
- `valid` (integer, required)
- `error` (integer, required)
- `empty` (integer, required)

### CellValueWithLinks

- `layer` (string, optional)
- `links` (list of Record, optional) — List of Record objects
- `messages` (list of ValidationMessage, optional)
- `updatedAt` (datetime, optional)
- `valid` (boolean, optional)
- `value` (CellValueUnion, optional)
- `metadata` (map from string to any, optional, deprecated) — Deprecated, use record level metadata instead.

### ValidationMessage

Record data validation messages

- `field` (string, optional)
- `type` (enum, optional)
  - Allowed values: `error`, `warn`, `info`
- `source` (enum, optional)
  - Allowed values: `required-constraint`, `unique-constraint`, `custom-logic`, `unlinked`, `invalid-option`, `is-artifact`
- `message` (string, optional)
- `path` (string, optional) — This JSONPath is based on the root of mapped cell object.

### RecordConfig

Configuration of a record or specific fields in the record

- `readonly` (boolean, optional)
- `fields` (map from string to CellConfig, optional)
- `markedForDeletion` (boolean, optional)

### Record

A single row of data in a Sheet

- `id` (string, required) — Record ID
- `values` (map from string to CellValue, required) — A single row of data in a Sheet
- `commitId` (string, optional) — Commit ID
- `config` (RecordConfig, optional) — Configuration of a record or specific fields in the record
- `metadata` (map from string to any, optional)
- `valid` (boolean, optional) — Auto-generated value based on whether the record contains a field with an error message. Cannot be set via the API.
- `messages` (list of ValidationMessage, optional, deprecated) — This record level `messages` property is deprecated and no longer stored or used. Use the `messages` property on the individual cell values instead. This property will be removed in a future release.
- `versionId` (string, optional, deprecated) — Deprecated, use `commitId` instead.

### CellValueUnion

### CellConfig

CellConfig

- `readonly` (boolean, optional)

### CellValue

- `valid` (boolean, optional)
- `messages` (list of ValidationMessage, optional)
- `value` (CellValueUnion, optional)
- `layer` (string, optional)
- `updatedAt` (datetime, optional)
- `metadata` (map from string to any, optional, deprecated) — Deprecated, use record level metadata instead.

## Examples

**Request**

```json
{
  "recordIds": [
    "recordIds",
    "recordIds"
  ]
}
```

**Response**

```json
{
  "success": true,
  "commitId": "commitId",
  "counts": {
    "total": 1,
    "valid": 1,
    "error": 1,
    "byField": {
      "byField": {
        "total": 1,
        "valid": 1,
        "error": 1,
        "empty": 1
      }
    },
    "errorsByField": {
      "errorsByField": 1
    }
  },
  "records": [
    {
      "id": "id",
      "values": {
        "values": {
          "layer": "layer",
          "links": [
            {
              "id": "id",
              "values": {
                "values": {}
              }
            },
            {
              "id": "id",
              "values": {
                "values": {}
              }
            }
          ],
          "messages": [
            {},
            {}
          ],
          "updatedAt": "2024-01-15T09:30:00Z",
          "valid": true,
          "value": "value",
          "metadata": {
            "metadata": {
              "key": "value"
            }
          }
        }
      },
      "valid": true,
      "messages": [
        {
          "field": "field",
          "type": "error",
          "source": "required-constraint",
          "message": "message",
          "path": "path"
        },
        {
          "field": "field",
          "type": "error",
          "source": "required-constraint",
          "message": "message",
          "path": "path"
        }
      ],
      "metadata": {
        "metadata": {
          "key": "value"
        }
      },
      "config": {
        "readonly": true,
        "fields": {
          "fields": {
            "readonly": true
          }
        },
        "markedForDeletion": true
      }
    },
    {
      "id": "id",
      "values": {
        "values": {
          "layer": "layer",
          "links": [
            {
              "id": "id",
              "values": {
                "values": {}
              }
            },
            {
              "id": "id",
              "values": {
                "values": {}
              }
            }
          ],
          "messages": [
            {},
            {}
          ],
          "updatedAt": "2024-01-15T09:30:00Z",
          "valid": true,
          "value": "value",
          "metadata": {
            "metadata": {
              "key": "value"
            }
          }
        }
      },
      "valid": true,
      "messages": [
        {
          "field": "field",
          "type": "error",
          "source": "required-constraint",
          "message": "message",
          "path": "path"
        },
        {
          "field": "field",
          "type": "error",
          "source": "required-constraint",
          "message": "message",
          "path": "path"
        }
      ],
      "metadata": {
        "metadata": {
          "key": "value"
        }
      },
      "config": {
        "readonly": true,
        "fields": {
          "fields": {
            "readonly": true
          }
        },
        "markedForDeletion": true
      }
    }
  ],
  "versionId": "versionId"
}
```

**SDK Code**

```typescript
import { FlatfileClient } from "@flatfile/api";

const client = new FlatfileClient({ token: "YOUR_TOKEN" });
await client.dataClips.addRecordsToClip("dataClipId", {
    recordIds: ["recordIds", "recordIds"]
});

```

```python
import requests

url = "https://api.x.flatfile.com/v1/data-clips/dataClipId/add-records"

payload = { "recordIds": ["recordIds", "recordIds"] }
headers = {
    "X-Disable-Hooks": "true",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.x.flatfile.com/v1/data-clips/dataClipId/add-records"

	payload := strings.NewReader("{\n  \"recordIds\": [\n    \"recordIds\",\n    \"recordIds\"\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-Disable-Hooks", "true")
	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.x.flatfile.com/v1/data-clips/dataClipId/add-records")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-Disable-Hooks"] = 'true'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"recordIds\": [\n    \"recordIds\",\n    \"recordIds\"\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.x.flatfile.com/v1/data-clips/dataClipId/add-records")
  .header("X-Disable-Hooks", "true")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"recordIds\": [\n    \"recordIds\",\n    \"recordIds\"\n  ]\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.x.flatfile.com/v1/data-clips/dataClipId/add-records', [
  'body' => '{
  "recordIds": [
    "recordIds",
    "recordIds"
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'X-Disable-Hooks' => 'true',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.x.flatfile.com/v1/data-clips/dataClipId/add-records");
var request = new RestRequest(Method.POST);
request.AddHeader("X-Disable-Hooks", "true");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"recordIds\": [\n    \"recordIds\",\n    \"recordIds\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-Disable-Hooks": "true",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["recordIds": ["recordIds", "recordIds"]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.x.flatfile.com/v1/data-clips/dataClipId/add-records")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```