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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ openapi: 3.0.3
2
+ info:
3
+ title: BackgroundFX Pro API
4
+ description: |
5
+ AI-powered background removal and replacement API.
6
+
7
+ ## Authentication
8
+ All API requests require authentication using Bearer tokens.
9
+
10
+ ## Rate Limiting
11
+ - Free tier: 100 requests/hour
12
+ - Pro tier: 1000 requests/hour
13
+ - Enterprise: Unlimited
14
+
15
+ ## File Limits
16
+ - Images: 50MB max
17
+ - Videos: 500MB max
18
+ - Batch: 100 files max
19
+ version: 1.0.0
20
+ contact:
21
+ email: api@backgroundfx.pro
22
+ url: https://backgroundfx.pro
23
+ license:
24
+ name: MIT
25
+ url: https://opensource.org/licenses/MIT
26
+
27
+ servers:
28
+ - url: https://api.backgroundfx.pro/v1
29
+ description: Production server
30
+ - url: https://staging-api.backgroundfx.pro/v1
31
+ description: Staging server
32
+ - url: http://localhost:8000/v1
33
+ description: Local development
34
+
35
+ security:
36
+ - BearerAuth: []
37
+
38
+ tags:
39
+ - name: Authentication
40
+ description: User authentication and authorization
41
+ - name: Processing
42
+ description: Image and video processing operations
43
+ - name: Projects
44
+ description: Project management
45
+ - name: Backgrounds
46
+ description: Background library and generation
47
+ - name: Users
48
+ description: User profile and settings
49
+ - name: Webhooks
50
+ description: Webhook management
51
+
52
+ paths:
53
+ /auth/login:
54
+ post:
55
+ tags: [Authentication]
56
+ summary: User login
57
+ security: []
58
+ requestBody:
59
+ required: true
60
+ content:
61
+ application/json:
62
+ schema:
63
+ type: object
64
+ required: [email, password]
65
+ properties:
66
+ email:
67
+ type: string
68
+ format: email
69
+ password:
70
+ type: string
71
+ minLength: 8
72
+ responses:
73
+ 200:
74
+ description: Successful login
75
+ content:
76
+ application/json:
77
+ schema:
78
+ $ref: '#/components/schemas/AuthResponse'
79
+ 401:
80
+ $ref: '#/components/responses/Unauthorized'
81
+
82
+ /auth/register:
83
+ post:
84
+ tags: [Authentication]
85
+ summary: Register new user
86
+ security: []
87
+ requestBody:
88
+ required: true
89
+ content:
90
+ application/json:
91
+ schema:
92
+ type: object
93
+ required: [email, password, name]
94
+ properties:
95
+ email:
96
+ type: string
97
+ format: email
98
+ password:
99
+ type: string
100
+ minLength: 8
101
+ name:
102
+ type: string
103
+ minLength: 2
104
+ responses:
105
+ 201:
106
+ description: User created successfully
107
+ content:
108
+ application/json:
109
+ schema:
110
+ $ref: '#/components/schemas/AuthResponse'
111
+ 400:
112
+ $ref: '#/components/responses/BadRequest'
113
+
114
+ /process/remove-background:
115
+ post:
116
+ tags: [Processing]
117
+ summary: Remove background from image
118
+ requestBody:
119
+ required: true
120
+ content:
121
+ multipart/form-data:
122
+ schema:
123
+ type: object
124
+ required: [file]
125
+ properties:
126
+ file:
127
+ type: string
128
+ format: binary
129
+ description: Image file (PNG, JPG, WebP)
130
+ model:
131
+ type: string
132
+ enum: [rembg, u2net, deeplab, custom]
133
+ default: rembg
134
+ quality:
135
+ type: string
136
+ enum: [low, medium, high, ultra]
137
+ default: high
138
+ return_mask:
139
+ type: boolean
140
+ default: false
141
+ edge_refinement:
142
+ type: number
143
+ minimum: 0
144
+ maximum: 100
145
+ default: 50
146
+ responses:
147
+ 200:
148
+ description: Background removed successfully
149
+ content:
150
+ application/json:
151
+ schema:
152
+ $ref: '#/components/schemas/ProcessingResult'
153
+ 400:
154
+ $ref: '#/components/responses/BadRequest'
155
+ 413:
156
+ $ref: '#/components/responses/PayloadTooLarge'
157
+
158
+ /process/batch:
159
+ post:
160
+ tags: [Processing]
161
+ summary: Process multiple files
162
+ requestBody:
163
+ required: true
164
+ content:
165
+ multipart/form-data:
166
+ schema:
167
+ type: object
168
+ required: [files]
169
+ properties:
170
+ files:
171
+ type: array
172
+ items:
173
+ type: string
174
+ format: binary
175
+ maxItems: 100
176
+ options:
177
+ type: string
178
+ description: JSON string of processing options
179
+ responses:
180
+ 202:
181
+ description: Batch job created
182
+ content:
183
+ application/json:
184
+ schema:
185
+ $ref: '#/components/schemas/BatchJob'
186
+
187
+ /process/jobs/{jobId}:
188
+ get:
189
+ tags: [Processing]
190
+ summary: Get batch job status
191
+ parameters:
192
+ - name: jobId
193
+ in: path
194
+ required: true
195
+ schema:
196
+ type: string
197
+ format: uuid
198
+ responses:
199
+ 200:
200
+ description: Job status retrieved
201
+ content:
202
+ application/json:
203
+ schema:
204
+ $ref: '#/components/schemas/BatchJob'
205
+ 404:
206
+ $ref: '#/components/responses/NotFound'
207
+
208
+ /process/replace-background:
209
+ post:
210
+ tags: [Processing]
211
+ summary: Replace image background
212
+ requestBody:
213
+ required: true
214
+ content:
215
+ application/json:
216
+ schema:
217
+ type: object
218
+ required: [image_id, background_id]
219
+ properties:
220
+ image_id:
221
+ type: string
222
+ background_id:
223
+ type: string
224
+ blend_mode:
225
+ type: string
226
+ enum: [normal, multiply, screen, overlay]
227
+ default: normal
228
+ responses:
229
+ 200:
230
+ description: Background replaced successfully
231
+ content:
232
+ application/json:
233
+ schema:
234
+ $ref: '#/components/schemas/ProcessingResult'
235
+
236
+ /backgrounds:
237
+ get:
238
+ tags: [Backgrounds]
239
+ summary: List available backgrounds
240
+ parameters:
241
+ - name: category
242
+ in: query
243
+ schema:
244
+ type: string
245
+ enum: [solid, gradient, pattern, nature, abstract, custom]
246
+ - name: page
247
+ in: query
248
+ schema:
249
+ type: integer
250
+ default: 1
251
+ - name: limit
252
+ in: query
253
+ schema:
254
+ type: integer
255
+ default: 20
256
+ maximum: 100
257
+ responses:
258
+ 200:
259
+ description: List of backgrounds
260
+ content:
261
+ application/json:
262
+ schema:
263
+ type: object
264
+ properties:
265
+ items:
266
+ type: array
267
+ items:
268
+ $ref: '#/components/schemas/Background'
269
+ total:
270
+ type: integer
271
+ page:
272
+ type: integer
273
+ pages:
274
+ type: integer
275
+
276
+ /backgrounds/generate:
277
+ post:
278
+ tags: [Backgrounds]
279
+ summary: Generate AI background
280
+ requestBody:
281
+ required: true
282
+ content:
283
+ application/json:
284
+ schema:
285
+ type: object
286
+ required: [prompt]
287
+ properties:
288
+ prompt:
289
+ type: string
290
+ minLength: 3
291
+ maxLength: 500
292
+ style:
293
+ type: string
294
+ enum: [realistic, artistic, abstract, gradient]
295
+ default: realistic
296
+ width:
297
+ type: integer
298
+ default: 1920
299
+ height:
300
+ type: integer
301
+ default: 1080
302
+ responses:
303
+ 201:
304
+ description: Background generated
305
+ content:
306
+ application/json:
307
+ schema:
308
+ $ref: '#/components/schemas/Background'
309
+
310
+ /projects:
311
+ get:
312
+ tags: [Projects]
313
+ summary: List user projects
314
+ parameters:
315
+ - $ref: '#/components/parameters/PageParam'
316
+ - $ref: '#/components/parameters/LimitParam'
317
+ - name: search
318
+ in: query
319
+ schema:
320
+ type: string
321
+ responses:
322
+ 200:
323
+ description: List of projects
324
+ content:
325
+ application/json:
326
+ schema:
327
+ type: object
328
+ properties:
329
+ items:
330
+ type: array
331
+ items:
332
+ $ref: '#/components/schemas/Project'
333
+ total:
334
+ type: integer
335
+
336
+ post:
337
+ tags: [Projects]
338
+ summary: Create new project
339
+ requestBody:
340
+ required: true
341
+ content:
342
+ application/json:
343
+ schema:
344
+ type: object
345
+ required: [name, type]
346
+ properties:
347
+ name:
348
+ type: string
349
+ type:
350
+ type: string
351
+ enum: [image, video, batch]
352
+ description:
353
+ type: string
354
+ responses:
355
+ 201:
356
+ description: Project created
357
+ content:
358
+ application/json:
359
+ schema:
360
+ $ref: '#/components/schemas/Project'
361
+
362
+ /webhooks:
363
+ post:
364
+ tags: [Webhooks]
365
+ summary: Register webhook
366
+ requestBody:
367
+ required: true
368
+ content:
369
+ application/json:
370
+ schema:
371
+ type: object
372
+ required: [url, events]
373
+ properties:
374
+ url:
375
+ type: string
376
+ format: uri
377
+ events:
378
+ type: array
379
+ items:
380
+ type: string
381
+ enum: [job.completed, job.failed, project.created]
382
+ secret:
383
+ type: string
384
+ responses:
385
+ 201:
386
+ description: Webhook registered
387
+ content:
388
+ application/json:
389
+ schema:
390
+ $ref: '#/components/schemas/Webhook'
391
+
392
+ components:
393
+ securitySchemes:
394
+ BearerAuth:
395
+ type: http
396
+ scheme: bearer
397
+ bearerFormat: JWT
398
+
399
+ parameters:
400
+ PageParam:
401
+ name: page
402
+ in: query
403
+ schema:
404
+ type: integer
405
+ default: 1
406
+ minimum: 1
407
+
408
+ LimitParam:
409
+ name: limit
410
+ in: query
411
+ schema:
412
+ type: integer
413
+ default: 20
414
+ minimum: 1
415
+ maximum: 100
416
+
417
+ schemas:
418
+ AuthResponse:
419
+ type: object
420
+ properties:
421
+ token:
422
+ type: string
423
+ refresh_token:
424
+ type: string
425
+ user:
426
+ $ref: '#/components/schemas/User'
427
+
428
+ User:
429
+ type: object
430
+ properties:
431
+ id:
432
+ type: string
433
+ format: uuid
434
+ email:
435
+ type: string
436
+ format: email
437
+ name:
438
+ type: string
439
+ plan:
440
+ type: string
441
+ enum: [free, pro, enterprise]
442
+ created_at:
443
+ type: string
444
+ format: date-time
445
+
446
+ ProcessingResult:
447
+ type: object
448
+ properties:
449
+ id:
450
+ type: string
451
+ format: uuid
452
+ image:
453
+ type: string
454
+ format: uri
455
+ mask:
456
+ type: string
457
+ format: uri
458
+ metadata:
459
+ type: object
460
+ properties:
461
+ width:
462
+ type: integer
463
+ height:
464
+ type: integer
465
+ format:
466
+ type: string
467
+ processing_time:
468
+ type: number
469
+
470
+ BatchJob:
471
+ type: object
472
+ properties:
473
+ id:
474
+ type: string
475
+ format: uuid
476
+ status:
477
+ type: string
478
+ enum: [pending, processing, completed, failed]
479
+ progress:
480
+ type: number
481
+ minimum: 0
482
+ maximum: 100
483
+ total_files:
484
+ type: integer
485
+ processed_files:
486
+ type: integer
487
+ results:
488
+ type: array
489
+ items:
490
+ $ref: '#/components/schemas/ProcessingResult'
491
+ created_at:
492
+ type: string
493
+ format: date-time
494
+
495
+ Background:
496
+ type: object
497
+ properties:
498
+ id:
499
+ type: string
500
+ url:
501
+ type: string
502
+ format: uri
503
+ thumbnail:
504
+ type: string
505
+ format: uri
506
+ category:
507
+ type: string
508
+ tags:
509
+ type: array
510
+ items:
511
+ type: string
512
+
513
+ Project:
514
+ type: object
515
+ properties:
516
+ id:
517
+ type: string
518
+ format: uuid
519
+ name:
520
+ type: string
521
+ type:
522
+ type: string
523
+ enum: [image, video, batch]
524
+ status:
525
+ type: string
526
+ enum: [draft, processing, completed]
527
+ files_count:
528
+ type: integer
529
+ created_at:
530
+ type: string
531
+ format: date-time
532
+
533
+ Webhook:
534
+ type: object
535
+ properties:
536
+ id:
537
+ type: string
538
+ format: uuid
539
+ url:
540
+ type: string
541
+ format: uri
542
+ events:
543
+ type: array
544
+ items:
545
+ type: string
546
+ active:
547
+ type: boolean
548
+ created_at:
549
+ type: string
550
+ format: date-time
551
+
552
+ Error:
553
+ type: object
554
+ properties:
555
+ error:
556
+ type: string
557
+ message:
558
+ type: string
559
+ details:
560
+ type: object
561
+
562
+ responses:
563
+ BadRequest:
564
+ description: Bad request
565
+ content:
566
+ application/json:
567
+ schema:
568
+ $ref: '#/components/schemas/Error'
569
+
570
+ Unauthorized:
571
+ description: Unauthorized
572
+ content:
573
+ application/json:
574
+ schema:
575
+ $ref: '#/components/schemas/Error'
576
+
577
+ NotFound:
578
+ description: Resource not found
579
+ content:
580
+ application/json:
581
+ schema:
582
+ $ref: '#/components/schemas/Error'
583
+
584
+ PayloadTooLarge:
585
+ description: File too large
586
+ content:
587
+ application/json:
588
+ schema:
589
+ $ref: '#/components/schemas/Error'
590
+
591
+ RateLimitExceeded:
592
+ description: Rate limit exceeded
593
+ content:
594
+ application/json:
595
+ schema:
596
+ $ref: '#/components/schemas/Error'