Images API Reference

1. Upload Images

POST https://api.wecompleteapp.com/api/users/user/{userId}/images

Request Format

Multipart form data with key "file"

// Swift example using URLSession
let boundary = "Boundary-(UUID().uuidString)"
var body = Data()

// Add each image to the form data
for image in images {
    body.append("--\(boundary)\r\n")
    body.append("Content-Disposition: form-data; name=\"file\"; filename=\"image.jpg\"\r\n")
    body.append("Content-Type: image/jpeg\r\n\r\n")
    body.append(image.jpegData(compressionQuality: 0.8)!)
    body.append("\r\n")
}

body.append("--\(boundary)--\r\n")

Response

{
  "success": true,
  "files": [
    {
      "data": {
        "url": "https://utfs.io/f/abc123.jpg",
        "key": "abc123.jpg"
      }
    },
    {
      "data": {
        "url": "https://utfs.io/f/def456.jpg",
        "key": "def456.jpg"
      }
    }
  ],
  "groupId": "group_789"
}

📌 Note:
- Max 4 images per request
- Files field name must be "file" (lowercase)
- Group ID returned when uploading multiple images
- Supported formats: JPEG, PNG, WEBP

2. Get User Images

GET https://api.wecompleteapp.com/api/users/user/{userId}/images

Response

[
  "{\n  \"_id\": \"123abc\",\n  \"userId\": \"user_67890\",\n  \"url\": \"https://utfs.io/f/abc123.jpg\",\n  \"key\": \"abc123.jpg\",\n  \"groupId\": \"group_456\",\n  \"createdAt\": 1706434800000\n}"
]

3. Get Image by ID

GET https://api.wecompleteapp.com/api/users/user/{userId}/images/{imageId}

Response

{
  "_id": "123abc",
  "userId": "user_67890",
  "url": "https://utfs.io/f/abc123.jpg",
  "key": "abc123.jpg",
  "groupId": "group_456",
  "createdAt": 1706434800000
}

4. Update Image

PUT https://api.wecompleteapp.com/api/users/user/{userId}/images/{imageId}

Update Flow

  1. Delete old image using DELETE endpoint
  2. Upload new image using POST endpoint
  3. Update record with new URL using PUT endpoint

Request Body

{
  "url": "https://utfs.io/f/new-image.jpg",
  "key": "new-image.jpg"
}

Response

{
  "_id": "123abc",
  "userId": "user_67890",
  "url": "https://utfs.io/f/abc123.jpg",
  "key": "abc123.jpg",
  "groupId": "group_456",
  "createdAt": 1706434800000
}

5. Delete Image

DELETE https://api.wecompleteapp.com/api/users/user/{userId}/images/{imageId}

Response

{
  "success": true,
  "deletedId": "123abc"
}

6. Group Operations

GET https://api.wecompleteapp.com/api/users/user/{userId}/images/group/{groupId}

Get all images in a group

DELETE https://api.wecompleteapp.com/api/users/user/{userId}/images/group/{groupId}

Delete entire image group

PUT https://api.wecompleteapp.com/api/users/user/{userId}/images/group/{groupId}

Bulk update group metadata

📘 Implementation Notes

  • Always include Content-Type: multipart/form-data header for uploads
  • Store returned key value for future updates/deletions
  • Group operations affect all images with the same groupId
  • Rate limit: 10 requests/minute per user