# API v3 Update - Complete
## What Changed
Based on your NocoDB instance showing API v3 documentation and [NocoDB 0.264.0 release notes](https://github.com/nocodb/nocodb/releases/tag/0.264.0), the code has been updated to:
1. **Use API v3 as primary** - All endpoints use v3 first (NocoDB 0.264.0+)
2. **Automatic fallback to v2** - If v3 fails, automatically tries v2 for compatibility
3. **Smart endpoint detection** - Detects which API version works and reports it
## API v3 Features (from 0.264.0 release)
According to the [NocoDB 0.264.0 release](https://github.com/nocodb/nocodb/releases/tag/0.264.0), API v3 includes:
- **Embedded relation field data** - Listing records returns paginated linked records inline
- **Unified record linking in CRUD** - Create or update record links directly in the main API call
- **Standardized responses & errors** - More predictable envelopes and status codes
- **Reduced API traffic** - Fewer HTTP calls thanks to embedded relations
- **Simplified workflows** - Handle records and relationships in a single request
## API v3 Endpoint Structure
From your Swagger documentation, API v3 uses:
### Meta APIs
- **Bases**: `/api/v3/meta/bases` (same as v2)
- **Tables**: `/api/v3/meta/bases/{base_id}/tables` (same as v2)
### Data APIs (Records)
- **List/Create**: `/api/v3/data/{base_id}/{table_id}/records`
- **Read Single**: `/api/v3/data/{base_id}/{table_id}/records/{recordId}`
- **Update**: `/api/v3/data/{base_id}/{table_id}/records?recordId={recordId}` (PATCH with query param)
- **Delete**: `/api/v3/data/{base_id}/{table_id}/records?recordId={recordId}` (DELETE with query param)
- **Count**: `/api/v3/data/{base_id}/{table_id}/count`
### Key Differences: v3 vs v2
**API v3:**
- ✅ Record endpoints **require** base_id: `/api/v3/data/{base_id}/{table_id}/records`
- ✅ Update/Delete use query parameter: `?recordId={recordId}`
- ✅ More structured endpoint paths
**API v2:**
- ✅ Record endpoints **don't require** base_id: `/api/v2/tables/{table_id}/records`
- ✅ Update/Delete use path parameter: `/records/{record_id}`
## Implementation Strategy
The code now:
1. **Tries v3 first** for all operations
2. **Falls back to v2** if v3 fails
3. **Reports which version worked** in response (`api_version` field)
4. **Maintains backward compatibility** (still accepts `project_id` parameter)
## Testing Checklist
Test with your instance at `nocodb.v1su4.com`:
- [ ] `nocodb_test_connection()` - Should detect v3
- [ ] `nocodb_list_projects()` - Should list bases via v3
- [ ] `nocodb_list_tables()` - Should list tables via v3
- [ ] `nocodb_get_records()` - Should get records via v3
- [ ] `nocodb_create_record()` - Should create via v3
- [ ] `nocodb_update_record()` - Should update via v3 (with recordId query)
- [ ] `nocodb_delete_record()` - Should delete via v3 (with recordId query)
- [ ] `nocodb_search_records()` - Should search via v3
- [ ] `nocodb_create_discord_reactions_table()` - Should create table via v3
- [ ] `nocodb_get_analytics()` - Should get analytics via v3
## Your Base IDs (from screenshot)
- **Base ID**: `pce7ccvwd1z09bx` (matches your earlier `pce7ccvwdlz09bx` - slight typo)
- **Storygen Table**: `m0q17m2gufkjp39`
- **Ideas API Table**: `mft4y2s8qq8621k`
## Next Steps
1. **Deploy updated code** - Build and deploy version 1.2.0
2. **Test all endpoints** - Verify v3 works with your instance
3. **Configure MinIO** - Set up S3 storage (see MINIO_S3_CONFIGURATION.md)
4. **Verify n8n** - Ensure n8n workflows work with API v3
## Compatibility
- ✅ **NocoDB Version**: Requires 0.264.0+ for full v3 support
- ✅ **n8n**: Should work with API v3 (n8n v0.200.0+ supports v2, may need update for v3)
- ✅ **Backward Compatible**: Tool signatures unchanged, v2 fallback for older instances
- ✅ **Auto-Detection**: Automatically uses v3 if available, falls back to v2
## API v3 Record Payload Format
For bulk operations in API v3, records should use the `fields` object format:
```json
[
{
"fields": {
"column_name": "value"
}
}
]
```
Single record operations can use direct field format or `fields` object.