# Records

## Create a new record

> Create a new record in a collection

```json
{"openapi":"3.1.0","info":{"title":"myJson API V2","version":"2.0.0"},"servers":[{"url":"https://api.myjson.online/v2","description":"Production server"}],"security":[{"CollectionAccessToken":[]}],"components":{"securitySchemes":{"CollectionAccessToken":{"type":"apiKey","in":"header","name":"x-collection-access-token","description":"Access token required for private collections (available on the specific collection's page)"}},"schemas":{"Record":{"type":"object","properties":{"data":{"type":"object","description":"The JSON data stored in the record"},"version":{"type":"integer"},"id":{"type":"string","format":"uuid"}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}},"paths":{"/records":{"post":{"summary":"Create a new record","description":"Create a new record in a collection","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["collectionId","data"],"properties":{"collectionId":{"type":"string","format":"uuid","description":"ID of the collection to create the record in"},"data":{"type":"object","description":"JSON object data to store in the record"},"metadata":{"type":"boolean","description":"Whether to include metadata in the response","default":true}}}}}},"responses":{"200":{"description":"Record created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Record"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient credit or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Collection not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Get a record

> Retrieve a record by its ID

```json
{"openapi":"3.1.0","info":{"title":"myJson API V2","version":"2.0.0"},"servers":[{"url":"https://api.myjson.online/v2","description":"Production server"}],"security":[{"CollectionAccessToken":[]}],"components":{"securitySchemes":{"CollectionAccessToken":{"type":"apiKey","in":"header","name":"x-collection-access-token","description":"Access token required for private collections (available on the specific collection's page)"}},"schemas":{"Record":{"type":"object","properties":{"data":{"type":"object","description":"The JSON data stored in the record"},"version":{"type":"integer"},"id":{"type":"string","format":"uuid"}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}},"paths":{"/records/{recordId}":{"get":{"summary":"Get a record","description":"Retrieve a record by its ID","parameters":[{"name":"metadata","in":"query","schema":{"type":"boolean","default":true},"description":"Whether to include metadata in the response"},{"name":"version","in":"query","schema":{"type":"integer"},"description":"Specific version of the record to retrieve"}],"responses":{"200":{"description":"Record retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Record"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient credit or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Update a record

> Update an existing record

```json
{"openapi":"3.1.0","info":{"title":"myJson API V2","version":"2.0.0"},"servers":[{"url":"https://api.myjson.online/v2","description":"Production server"}],"security":[{"CollectionAccessToken":[]}],"components":{"securitySchemes":{"CollectionAccessToken":{"type":"apiKey","in":"header","name":"x-collection-access-token","description":"Access token required for private collections (available on the specific collection's page)"}},"schemas":{"Record":{"type":"object","properties":{"data":{"type":"object","description":"The JSON data stored in the record"},"version":{"type":"integer"},"id":{"type":"string","format":"uuid"}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}},"paths":{"/records/{recordId}":{"put":{"summary":"Update a record","description":"Update an existing record","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["collectionId","data"],"properties":{"data":{"type":"object","description":"JSON object data to store in the record"},"metadata":{"type":"boolean","description":"Whether to include metadata in the response"}}}}}},"responses":{"200":{"description":"Record created/updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Record"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient credit or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Delete a record

> Remove a record permanently

```json
{"openapi":"3.1.0","info":{"title":"myJson API V2","version":"2.0.0"},"servers":[{"url":"https://api.myjson.online/v2","description":"Production server"}],"security":[{"CollectionAccessToken":[]}],"components":{"securitySchemes":{"CollectionAccessToken":{"type":"apiKey","in":"header","name":"x-collection-access-token","description":"Access token required for private collections (available on the specific collection's page)"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}},"paths":{"/records/{recordId}":{"delete":{"summary":"Delete a record","description":"Remove a record permanently","responses":{"200":{"description":"Record deleted successfully"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient credit or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Partially update a record

> Update specific fields of an existing record

```json
{"openapi":"3.1.0","info":{"title":"myJson API V2","version":"2.0.0"},"servers":[{"url":"https://api.myjson.online/v2","description":"Production server"}],"security":[{"CollectionAccessToken":[]}],"components":{"securitySchemes":{"CollectionAccessToken":{"type":"apiKey","in":"header","name":"x-collection-access-token","description":"Access token required for private collections (available on the specific collection's page)"}},"schemas":{"Record":{"type":"object","properties":{"data":{"type":"object","description":"The JSON data stored in the record"},"version":{"type":"integer"},"id":{"type":"string","format":"uuid"}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}},"paths":{"/records/{recordId}":{"patch":{"summary":"Partially update a record","description":"Update specific fields of an existing record","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","description":"JSON object data to update in the record"},"metadata":{"type":"boolean","description":"Whether to include metadata in the response"}}}}}},"responses":{"200":{"description":"Record updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Record"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Insufficient credit or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```
