Skip to main content
Important: Shop tag records have dependencies on both shops and tags. The system validates both the shop_id and tag_id fields against existing records in the database. You should upload shops and tags before uploading shop tag mappings to ensure proper data validation.

Authentication Required

This endpoint requires API key authentication via Bearer token in the Authorization header.
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

About the Data API

This endpoint is part of the Cobi Data API (/v1/data/:type), which provides a consistent interface for uploading different types of structured data.

Request Body

records
array
required
An array of shop tag mapping records (up to 5000)

Response

The API returns a JSON response with the following fields:
{
  "request_id": "string", // Unique ID for the overall request
  "type": "shop-tags", // Type of data being processed
  "batches": [
    {
      "batch": 1, // Sequential batch number
      "status": 200, // HTTP-like status code (200, 207, 400, 500)
      "data": {
        "status": "success", // "success", "partial", or "error"
        "type": "shop-tags", // Matches the top-level type
        "message": "Records uploaded successfully", // Summary message
        "request_id": "string",
        "batch_id": "string",
        "error": "" // Optional — empty or null on success; contains error details otherwise
      }
    }
  ]
}
FieldTypeDescription
request_idstringUnique ID for the overall request
typestringType of data being processed (e.g., “shop-tags”)
batchesarrayArray of batch results
batches[].batchintSequential batch number
batches[].statusintHTTP-like status code (200, 207, 400, 500)
batches[].dataobjectBatch result details
batches[].data.statusstring”success”, “partial”, or “error”
batches[].data.typestringMatches the top-level type
batches[].data.messagestringSummary message of the batch result
batches[].data.request_idstringUnique request ID for the batch
batches[].data.batch_idstringUnique batch ID
batches[].data.errorstringError details (empty or null on success)

Error Codes

Status CodeDescriptiondata.status value
200All records processed successfullysuccess
207Some records failed, others succeededpartial
400Validation or dependency errorerror
500Internal or unexpected server errorerror
401Unauthorized - Invalid or missing API keyerror

Example

curl -X POST https://api.hellocobi.com/v1/data/shop-tags \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "records": [
      {
        "shop_tag_id": "550e8400-e29b-41d4-a716-446655440000",
        "shop_id": "550e8400-e29b-41d4-a716-446655440001",
        "tag_id": "550e8400-e29b-41d4-a716-446655440002",
        "created": "2023-01-15T14:30:00Z",
        "updated": "2023-06-22T09:15:30Z",
        "is_deleted": false
      }
    ]
  }'

Best Practices

  1. Upload Order: Upload shops and tags before shop-tags to ensure references exist
  2. Batch Size: Upload up to 5000 records at a time for optimal performance
  3. Data Validation: Ensure all required fields are present and properly formatted
  4. Error Handling: Implement proper error handling for failed requests
  5. Rate Limiting: Be mindful of API rate limits
Need help? Contact our support team at [email protected]