forked from dgtlmoon/changedetection.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi-spec.yaml
More file actions
1602 lines (1508 loc) · 55.6 KB
/
api-spec.yaml
File metadata and controls
1602 lines (1508 loc) · 55.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.1.0
info:
title: ChangeDetection.io API
description: |
# ChangeDetection.io Web page monitoring and notifications API
REST API for managing Page watches, Group tags, and Notifications.
changedetection.io can be driven by its built in simple API, in the examples below you will also find `curl` command line and `python` examples to help you get started faster.
## Where to find my API key?
The API key can be easily found under the **SETTINGS** then **API** tab of changedetection.io dashboard.
Simply click the API key to automatically copy it to your clipboard.

## Connection URL
The API can be found at `/api/v1/`, so for example if you run changedetection.io locally on port 5000, then URL would be `http://localhost:5000/api/v1/watch/cc0cfffa-f449-477b-83ea-0caafd1dc091/history`.
If you are using the hosted/subscription version of changedetection.io, then the URL is based on your login URL, for example:
`https://<your login url>/api/v1/watch/cc0cfffa-f449-477b-83ea-0caafd1dc091/history`
## Authentication
Almost all API requests require some authentication, this is provided as an **API Key** in the header of the HTTP request.
For example: `x-api-key: YOUR_API_KEY`
version: 0.1.4
contact:
name: ChangeDetection.io
url: https://github.com/dgtlmoon/changedetection.io
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: http://localhost:5000/api/v1
description: Development server
- url: https://yourdomain.com/api/v1
description: Production server
- url: '{protocol}://{host}/api/v1'
description: Custom server
variables:
protocol:
enum:
- http
- https
default: https
host:
default: yourdomain.com
description: Your changedetection.io host
security:
- ApiKeyAuth: []
tags:
- name: Watch Management
description: |
Core functionality for managing web page monitors. Create, retrieve, update, and delete individual watches.
Each watch represents a single URL being monitored for changes, with configurable settings for check intervals,
notification preferences, and content filtering options.
- name: Watch History
description: |
Get a list of timestamps of all changes detected for a watch.
- name: Snapshots
description: |
Retrieve individual text snapshot of monitored content according to the `timestamp`. The text snapshot is the HTML
to Text at page check time.
Set the query argument `html` to any value to retrieve the last HTML fetched, the system only keeps the last two
(2) HTML files fetched.
Use the Watch History API endpoint to get a list of timestamps to pass to this query.
- name: Favicon
description: |
Retrieve favicon images associated with monitored web pages. These are used in the dashboard interface
to visually identify different watches in your monitoring list.
- name: Group / Tag Management
description: |
Organize your watches using tags and groups. Tags (also known as Groups) allow you to categorize monitors, set group-wide
notification preferences, and perform bulk operations like mass rechecking or status changes across
multiple related watches.
- name: Notifications
description: |
Configure global notification endpoints that can be used across all your watches. Supports various
notification services including email, Discord, Slack, webhooks, and many other popular platforms.
These settings serve as defaults that can be overridden at the individual watch or tag level.
The notification syntax uses [https://github.com/caronc/apprise](https://github.com/caronc/apprise).
- name: Search
description: |
Search and filter your watches by URL patterns, titles, or tags. Useful for quickly finding specific
monitors in large collections or identifying watches that match certain criteria.
- name: Import
description: |
Bulk import multiple URLs for monitoring. Accepts plain text lists of URLs and can automatically
apply tags, proxy settings, and other configurations to all imported watches simultaneously.
- name: System Information
description: |
Retrieve system status and statistics about your changedetection.io instance, including total watch
counts, uptime information, and version details.
components:
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: x-api-key
description: |
API key for authentication. You can find your API key in the changedetection.io dashboard under Settings > API.
Enter your API key in the "Authorize" button above to automatically populate all code examples.
schemas:
WatchBase:
type: object
properties:
url:
type: string
format: uri
description: URL to monitor for changes
maxLength: 5000
title:
type: string
description: Custom title for the web page change monitor (watch), not to be confused with page_title
maxLength: 5000
tag:
type: string
description: Tag UUID to associate with this web page change monitor (watch)
maxLength: 5000
tags:
type: array
items:
type: string
description: Array of tag UUIDs
paused:
type: boolean
description: Whether the web page change monitor (watch) is paused
notification_muted:
type: boolean
description: Whether notifications are muted
method:
type: string
enum: [GET, POST, DELETE, PUT]
description: HTTP method to use
fetch_backend:
type: string
enum: [html_requests, html_webdriver]
description: Backend to use for fetching content
headers:
type: object
additionalProperties:
type: string
description: HTTP headers to include in requests
body:
type: string
description: HTTP request body
maxLength: 5000
proxy:
type: string
description: Proxy configuration
maxLength: 5000
webdriver_delay:
type: integer
description: Delay in seconds for webdriver
webdriver_js_execute_code:
type: string
description: JavaScript code to execute
maxLength: 5000
time_between_check:
type: object
properties:
weeks:
type: integer
minimum: 0
maximum: 52000
nullable: true
days:
type: integer
minimum: 0
maximum: 365000
nullable: true
hours:
type: integer
minimum: 0
maximum: 8760000
nullable: true
minutes:
type: integer
minimum: 0
maximum: 525600000
nullable: true
seconds:
type: integer
minimum: 0
maximum: 31536000000
nullable: true
description: Time intervals between checks. All fields must be non-negative. At least one non-zero value required when not using default settings.
time_between_check_use_default:
type: boolean
default: true
description: Whether to use global settings for time between checks - defaults to true if not set
notification_urls:
type: array
items:
type: string
maxLength: 1000
maxItems: 100
description: Notification URLs for this web page change monitor (watch). Maximum 100 URLs.
notification_title:
type: string
description: Custom notification title
maxLength: 5000
notification_body:
type: string
description: Custom notification body
maxLength: 5000
notification_format:
type: string
enum: ['text', 'html', 'htmlcolor', 'markdown', 'System default']
description: Format for notifications
track_ldjson_price_data:
type: boolean
description: Whether to track JSON-LD price data
browser_steps:
type: array
items:
type: object
properties:
operation:
type: string
maxLength: 5000
nullable: true
selector:
type: string
maxLength: 5000
nullable: true
optional_value:
type: string
maxLength: 5000
nullable: true
required: [operation, selector, optional_value]
additionalProperties: false
maxItems: 100
description: Browser automation steps. Maximum 100 steps allowed.
processor:
type: string
enum: [restock_diff, text_json_diff]
default: text_json_diff
description: Optional processor mode to use for change detection. Defaults to `text_json_diff` if not specified.
Watch:
allOf:
- $ref: '#/components/schemas/WatchBase'
- type: object
properties:
uuid:
type: string
format: uuid
description: Unique identifier for the web page change monitor (watch)
readOnly: true
last_checked:
type: integer
description: Unix timestamp of last check
readOnly: true
last_changed:
type: integer
description: Unix timestamp of last change
readOnly: true
last_error:
type: string
description: Last error message
readOnly: true
last_viewed:
type: integer
description: Unix timestamp in seconds of the last time the watch was viewed. Setting it to a value higher than `last_changed` in the "Update watch" endpoint marks the watch as viewed.
minimum: 0
link:
type: string
format: string
description: The watch URL rendered in case of any Jinja2 markup, always use this for listing.
readOnly: true
CreateWatch:
allOf:
- $ref: '#/components/schemas/WatchBase'
- type: 'object'
required:
- url
UpdateWatch:
allOf:
- $ref: '#/components/schemas/WatchBase'
- type: object
properties:
last_viewed:
type: integer
description: Unix timestamp in seconds of the last time the watch was viewed. Setting it to a value higher than `last_changed` in the "Update watch" endpoint marks the watch as viewed.
minimum: 0
Tag:
type: object
properties:
uuid:
type: string
format: uuid
description: Unique identifier for the tag
readOnly: true
title:
type: string
description: Tag title
maxLength: 5000
notification_urls:
type: array
items:
type: string
description: Default notification URLs for web page change monitors (watches) with this tag
notification_muted:
type: boolean
description: Whether notifications are muted for this tag
CreateTag:
allOf:
- $ref: '#/components/schemas/Tag'
- type: object
required:
- title
NotificationUrls:
type: object
properties:
notification_urls:
type: array
items:
type: string
format: uri
description: List of notification URLs
required:
- notification_urls
SystemInfo:
type: object
properties:
watch_count:
type: integer
description: Total number of web page change monitors (watches)
tag_count:
type: integer
description: Total number of tags
uptime:
type: string
description: System uptime
version:
type: string
description: Application version
SearchResult:
type: object
properties:
watches:
type: object
additionalProperties:
$ref: '#/components/schemas/Watch'
description: Dictionary of matching web page change monitors (watches) keyed by UUID
WatchHistory:
type: object
additionalProperties:
type: string
description: Path to snapshot file
description: Dictionary of timestamps and snapshot paths
Error:
type: object
properties:
message:
type: string
description: Error message
paths:
/watch:
get:
operationId: listWatches
tags: [Watch Management]
summary: List all watches
description: Return concise list of available web page change monitors (watches) and basic info
x-code-samples:
- lang: 'curl'
source: |
curl -X GET "http://localhost:5000/api/v1/watch" \
-H "x-api-key: YOUR_API_KEY"
- lang: 'Python'
source: |
import requests
headers = {'x-api-key': 'YOUR_API_KEY'}
response = requests.get('http://localhost:5000/api/v1/watch', headers=headers)
print(response.json())
parameters:
- name: recheck_all
in: query
description: Set to 1 to force recheck of all watches
schema:
type: string
enum: ["1"]
- name: tag
in: query
description: Tag name to filter results
schema:
type: string
responses:
'200':
description: List of watches
content:
application/json:
schema:
type: object
additionalProperties:
$ref: '#/components/schemas/Watch'
example:
"095be615-a8ad-4c33-8e9c-c7612fbf6c9f":
uuid: "095be615-a8ad-4c33-8e9c-c7612fbf6c9f"
url: "http://example.com?id={{1+1}} - the raw URL"
link: "http://example.com?id=2 - the rendered URL, always use this for listing."
title: "Example Website Monitor - manually entered title/description"
page_title: "The HTML <title> from the page"
tags: ["550e8400-e29b-41d4-a716-446655440000"]
paused: false
notification_muted: false
method: "GET"
fetch_backend: "html_requests"
last_checked: 1640995200
last_changed: 1640995200
"7c9e6b8d-f2a1-4e5c-9d3b-8a7f6e4c2d1a":
uuid: "7c9e6b8d-f2a1-4e5c-9d3b-8a7f6e4c2d1a"
url: "http://example.com?id={{1+1}} - the raw URL"
link: "http://example.com?id=2 - the rendered URL, always use this for listing."
title: "News Site Tracker - manually entered title/description"
page_title: "The HTML <title> from the page"
tags: ["330e8400-e29b-41d4-a716-446655440001"]
paused: false
notification_muted: true
method: "GET"
fetch_backend: "html_webdriver"
last_checked: 1640998800
last_changed: 1640995200
post:
operationId: createWatch
tags: [Watch Management]
summary: Create a new watch
description: |
Create a single web page change monitor (watch). Requires at least `url` to be set.
Every watch can be configured with:
- **Processor mode**: `processor` field (`restock_diff` or `text_json_diff` - default)
- **Notification settings**: `notification_urls` (array), `notification_title`, `notification_body`, `notification_format`, `notification_muted`
- **Tags/Groups**: `tag` (UUID string) or `tags` (array of UUIDs)
- **Check settings**: `time_between_check`, `paused`, `method`, `fetch_backend`
- **Advanced options**: `headers`, `body`, `proxy`, `browser_steps`, and more
x-code-samples:
- lang: 'curl'
source: |
curl -X POST "http://localhost:5000/api/v1/watch" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com",
"title": "Example Site Monitor",
"time_between_check": {
"hours": 1
}
}'
- lang: 'Python'
source: |
import requests
import json
headers = {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
}
data = {
'url': 'https://example.com',
'title': 'Example Site Monitor',
'time_between_check': {
'hours': 1
}
}
response = requests.post('http://localhost:5000/api/v1/watch',
headers=headers, json=data)
print(response.text)
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateWatch'
example:
url: "https://example.com"
title: "Example Site Monitor"
time_between_check:
hours: 1
responses:
'200':
description: Web page change monitor (watch) created successfully
content:
text/plain:
schema:
type: string
example: "OK"
'500':
description: Server error
content:
text/plain:
schema:
type: string
/watch/{uuid}:
get:
operationId: getWatch
tags: [Watch Management]
summary: Get single watch
description: Retrieve web page change monitor (watch) information and set muted/paused status. Returns the FULL Watch JSON.
x-code-samples:
- lang: 'curl'
source: |
curl -X GET "http://localhost:5000/api/v1/watch/095be615-a8ad-4c33-8e9c-c7612fbf6c9f" \
-H "x-api-key: YOUR_API_KEY"
- lang: 'Python'
source: |
import requests
headers = {'x-api-key': 'YOUR_API_KEY'}
uuid = '095be615-a8ad-4c33-8e9c-c7612fbf6c9f'
response = requests.get(f'http://localhost:5000/api/v1/watch/{uuid}', headers=headers)
print(response.json())
parameters:
- name: uuid
in: path
required: true
description: Web page change monitor (watch) unique ID
schema:
type: string
format: uuid
- name: recheck
in: query
description: Recheck this web page change monitor (watch)
schema:
type: string
enum: ["1", "true"]
- name: paused
in: query
description: Set pause state
schema:
type: string
enum: [paused, unpaused]
- name: muted
in: query
description: Set mute state
schema:
type: string
enum: [muted, unmuted]
responses:
'200':
description: Watch information or operation result
content:
application/json:
schema:
$ref: '#/components/schemas/Watch'
text/plain:
schema:
type: string
example: "OK"
'404':
description: Web page change monitor (watch) not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
put:
operationId: updateWatch
tags: [Watch Management]
summary: Update watch
description: Update an existing web page change monitor (watch) using JSON. Accepts the same structure as returned in [get single watch information](#operation/getWatch).
x-code-samples:
- lang: 'curl'
source: |
curl -X PUT "http://localhost:5000/api/v1/watch/095be615-a8ad-4c33-8e9c-c7612fbf6c9f" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://updated-example.com",
"title": "Updated Monitor",
"paused": false
}'
- lang: 'Python'
source: |
import requests
headers = {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
}
uuid = '095be615-a8ad-4c33-8e9c-c7612fbf6c9f'
data = {
'url': 'https://updated-example.com',
'title': 'Updated Monitor',
'paused': False
}
response = requests.put(f'http://localhost:5000/api/v1/watch/{uuid}',
headers=headers, json=data)
print(response.text)
parameters:
- name: uuid
in: path
required: true
description: Web page change monitor (watch) unique ID
schema:
type: string
format: uuid
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateWatch'
responses:
'200':
description: Web page change monitor (watch) updated successfully
content:
text/plain:
schema:
type: string
example: "OK"
'500':
description: Server error
delete:
operationId: deleteWatch
tags: [Watch Management]
summary: Delete watch
description: Delete a web page change monitor (watch) and all related history
x-code-samples:
- lang: 'curl'
source: |
curl -X DELETE "http://localhost:5000/api/v1/watch/095be615-a8ad-4c33-8e9c-c7612fbf6c9f" \
-H "x-api-key: YOUR_API_KEY"
- lang: 'Python'
source: |
import requests
headers = {'x-api-key': 'YOUR_API_KEY'}
uuid = '095be615-a8ad-4c33-8e9c-c7612fbf6c9f'
response = requests.delete(f'http://localhost:5000/api/v1/watch/{uuid}', headers=headers)
print(response.text)
parameters:
- name: uuid
in: path
required: true
description: Web page change monitor (watch) unique ID
schema:
type: string
format: uuid
responses:
'200':
description: Web page change monitor (watch) deleted successfully
content:
text/plain:
schema:
type: string
example: "OK"
/watch/{uuid}/history:
get:
operationId: getWatchHistory
tags: [Watch History]
summary: Get watch history
description: |
Get a list of all historical snapshots available for a web page change monitor (watch), use the key `timestamp`
as the query argument for fetching a single watch history snapshot.
x-code-samples:
- lang: 'curl'
source: |
curl -X GET "http://localhost:5000/api/v1/watch/095be615-a8ad-4c33-8e9c-c7612fbf6c9f/history" \
-H "x-api-key: YOUR_API_KEY"
- lang: 'Python'
source: |
import requests
headers = {'x-api-key': 'YOUR_API_KEY'}
uuid = '095be615-a8ad-4c33-8e9c-c7612fbf6c9f'
response = requests.get(f'http://localhost:5000/api/v1/watch/{uuid}/history', headers=headers)
print(response.json())
parameters:
- name: uuid
in: path
required: true
description: Web page change monitor (watch) unique ID
schema:
type: string
format: uuid
responses:
'200':
description: List of available snapshots
content:
application/json:
schema:
$ref: '#/components/schemas/WatchHistory'
example:
"1640995200": "/path/to/snapshot1.txt"
"1640998800": "/path/to/snapshot2.txt"
'404':
description: Web page change monitor (watch) not found
/watch/{uuid}/history/{timestamp}:
get:
operationId: getWatchSnapshot
tags: [Snapshots]
summary: Get single snapshot
description: |
Get single snapshot from web page change monitor (watch). Use 'latest' for the most recent snapshot.
Use the Watch History API to get a list of timestamps to pass.
x-code-samples:
- lang: 'curl'
source: |
curl -X GET "http://localhost:5000/api/v1/watch/095be615-a8ad-4c33-8e9c-c7612fbf6c9f/history/latest" \
-H "x-api-key: YOUR_API_KEY"
- lang: 'Python'
source: |
import requests
headers = {'x-api-key': 'YOUR_API_KEY'}
uuid = '095be615-a8ad-4c33-8e9c-c7612fbf6c9f'
timestamp = 'latest' # or use specific timestamp like 1640995200
response = requests.get(f'http://localhost:5000/api/v1/watch/{uuid}/history/{timestamp}', headers=headers)
print(response.text)
parameters:
- name: uuid
in: path
required: true
description: Web page change monitor (watch) unique ID
schema:
type: string
format: uuid
- name: timestamp
in: path
required: true
description: Snapshot timestamp or 'latest'
schema:
oneOf:
- type: integer
- type: string
enum: [latest]
- name: html
in: query
description: Set to 1 to return the last HTML
schema:
type: string
enum: ["1"]
responses:
'200':
description: Snapshot content
content:
text/plain:
schema:
type: string
'404':
description: Snapshot not found
/watch/{uuid}/difference/{from_timestamp}/{to_timestamp}:
get:
operationId: getWatchHistoryDiff
tags: [Watch History]
summary: Get the difference between two snapshots
description: |
Generate a difference (comparison) between two historical snapshots of a web page change monitor (watch).
This endpoint compares content between two points in time and returns the differences in your chosen format.
Perfect for reviewing what changed between specific versions or comparing recent changes.
**Timestamp Keywords:**
- Use `'latest'` for the most recent snapshot (to_timestamp)
- Use `'previous'` for the second-most-recent snapshot (from_timestamp)
- Or use specific Unix timestamps from the watch history
**Format Options:**
- `text` (default): Plain text with (removed) and (added) prefixes
- `html`: HTML format with (removed) and (added) text
- `htmlcolor`: Rich HTML with colored highlights (green for additions, red for deletions)
**Word-Level Diffing:**
- Enable word-level granularity with `word_diff=true` for detailed inline comparisons
- Disable with `word_diff=false` for line-level comparisons only (default false/off, line-level mode by default)
**Raw Diff Output:**
- Use `no_markup=true` to get raw diff content without any formatting applied
- Returns content with placeholders for opening/closing tags of changes
- Allows you to implement your own custom colorisation or formatting
- Skips all HTML color application and service tweaks (added text, html color tags, etc)
x-code-samples:
- lang: 'curl'
source: |
# Compare previous snapshot to latest with colored HTML
curl -X GET "http://localhost:5000/api/v1/watch/095be615-a8ad-4c33-8e9c-c7612fbf6c9f/difference/previous/latest?format=htmlcolor" \
-H "x-api-key: YOUR_API_KEY"
# Compare two specific timestamps in plain text with word-level diff
curl -X GET "http://localhost:5000/api/v1/watch/095be615-a8ad-4c33-8e9c-c7612fbf6c9f/difference/1640995200/1640998800?format=text&word_diff=true" \
-H "x-api-key: YOUR_API_KEY"
# Show only additions (hide removed/replaced content), ignore whitespace
curl -X GET "http://localhost:5000/api/v1/watch/095be615-a8ad-4c33-8e9c-c7612fbf6c9f/difference/previous/latest?format=htmlcolor&removed=false&replaced=false&ignoreWhitespace=true" \
-H "x-api-key: YOUR_API_KEY"
- lang: 'Python'
source: |
import requests
headers = {'x-api-key': 'YOUR_API_KEY'}
uuid = '095be615-a8ad-4c33-8e9c-c7612fbf6c9f'
# Compare previous to latest with colored HTML output
response = requests.get(
f'http://localhost:5000/api/v1/watch/{uuid}/difference/previous/latest',
headers=headers,
params={'format': 'htmlcolor'}
)
print(response.text)
# Compare specific timestamps with word-level diff
from_ts = '1640995200'
to_ts = '1640998800'
response = requests.get(
f'http://localhost:5000/api/v1/watch/{uuid}/difference/{from_ts}/{to_ts}',
headers=headers,
params={'format': 'text', 'word_diff': 'true'}
)
print(response.text)
# Show only additions, ignore whitespace and use word-level diff
response = requests.get(
f'http://localhost:5000/api/v1/watch/{uuid}/difference/previous/latest',
headers=headers,
params={
'format': 'htmlcolor',
'type': 'diffWords',
'removed': 'false',
'replaced': 'false',
'ignoreWhitespace': 'true'
}
)
print(response.text)
parameters:
- name: uuid
in: path
required: true
description: Web page change monitor (watch) unique ID
schema:
type: string
format: uuid
- name: from_timestamp
in: path
required: true
description: Starting snapshot timestamp, 'previous' for second-most-recent, or specific Unix timestamp
schema:
oneOf:
- type: integer
description: Unix timestamp of the starting snapshot
- type: string
enum: [previous]
description: Use 'previous' to automatically select the second-most-recent snapshot
example: previous
- name: to_timestamp
in: path
required: true
description: Ending snapshot timestamp, 'latest' for most recent, or specific Unix timestamp
schema:
oneOf:
- type: integer
description: Unix timestamp of the ending snapshot
- type: string
enum: [latest]
description: Use 'latest' to automatically select the most recent snapshot
example: latest
- name: format
in: query
description: |
Output format for the diff:
- `text` (default): Plain text with (removed) and (added) prefixes
- `html`: Basic HTML format
- `htmlcolor`: Rich HTML with colored backgrounds (red for deletions, green for additions)
- `markdown`: Markdown format with HTML rendering
schema:
type: string
enum: [text, html, htmlcolor, markdown]
default: text
- name: word_diff
in: query
description: |
Enable word-level diffing for more granular comparisons.
When enabled, changes are highlighted at the word level rather than line level.
Default is false (line-level mode).
Accepts: true, false, 1, 0, yes, no, on, off
schema:
type: string
enum: ["true", "false", "1", "0", "yes", "no", "on", "off"]
default: "false"
- name: no_markup
in: query
description: |
When set to true, returns the raw diff content without any markup formatting.
The content will include placeholders for opening/closing tags of the changes,
allowing you to implement your own custom colorisation or formatting.
This skips all HTML color application and service tweaks.
Accepts: true, false, 1, 0, yes, no, on, off
schema:
type: string
enum: ["true", "false", "1", "0", "yes", "no", "on", "off"]
default: "false"
- name: type
in: query
description: |
Diff granularity type:
- `diffLines` (default): Line-level comparison, showing which lines changed
- `diffWords`: Word-level comparison, showing which words changed within lines
This parameter is an alternative to `word_diff` for better alignment with the UI.
If both are specified, `type=diffWords` will enable word-level diffing.
schema:
type: string
enum: [diffLines, diffWords]
default: diffLines
- name: changesOnly
in: query
description: |
When enabled, only show lines/content that changed (no surrounding context).
When disabled, include unchanged lines for context around changes.
Accepts: true, false, 1, 0, yes, no, on, off
schema:
type: string
enum: ["true", "false", "1", "0", "yes", "no", "on", "off"]
default: "true"
- name: ignoreWhitespace
in: query
description: |
When enabled, ignore whitespace-only changes (spaces, tabs, newlines).
Useful for focusing on content changes and ignoring formatting differences.
Accepts: true, false, 1, 0, yes, no, on, off
schema:
type: string
enum: ["true", "false", "1", "0", "yes", "no", "on", "off"]
default: "false"
- name: removed
in: query
description: |
Include removed/deleted content in the diff output.
When disabled, content that was deleted will not appear in the diff.
Accepts: true, false, 1, 0, yes, no, on, off
schema:
type: string
enum: ["true", "false", "1", "0", "yes", "no", "on", "off"]
default: "true"
- name: added
in: query
description: |
Include added/new content in the diff output.
When disabled, content that was added will not appear in the diff.
Accepts: true, false, 1, 0, yes, no, on, off
schema:
type: string
enum: ["true", "false", "1", "0", "yes", "no", "on", "off"]
default: "true"
- name: replaced
in: query
description: |
Include replaced/modified content in the diff output.
When disabled, content that was modified (changed from one value to another) will not appear in the diff.
Accepts: true, false, 1, 0, yes, no, on, off
schema:
type: string
enum: ["true", "false", "1", "0", "yes", "no", "on", "off"]
default: "true"
responses:
'200':
description: Formatted diff between the two snapshots
content:
text/plain:
schema: