originalpictures-sdk 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- originalpictures_sdk-1.0.0/.gitignore +23 -0
- originalpictures_sdk-1.0.0/LICENSE +202 -0
- originalpictures_sdk-1.0.0/PKG-INFO +374 -0
- originalpictures_sdk-1.0.0/README.md +342 -0
- originalpictures_sdk-1.0.0/pyproject.toml +62 -0
- originalpictures_sdk-1.0.0/src/originalpictures/__init__.py +66 -0
- originalpictures_sdk-1.0.0/src/originalpictures/_generated/__init__.py +4 -0
- originalpictures_sdk-1.0.0/src/originalpictures/_generated/public_api.py +20243 -0
- originalpictures_sdk-1.0.0/src/originalpictures/client.py +838 -0
- originalpictures_sdk-1.0.0/src/originalpictures/errors.py +115 -0
- originalpictures_sdk-1.0.0/src/originalpictures/helpers.py +272 -0
- originalpictures_sdk-1.0.0/src/originalpictures/public_checks.py +279 -0
- originalpictures_sdk-1.0.0/src/originalpictures/py.typed +1 -0
- originalpictures_sdk-1.0.0/src/originalpictures/webhooks.py +84 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
.venv/
|
|
5
|
+
.mypy_cache/
|
|
6
|
+
.ruff_cache/
|
|
7
|
+
.pytest_cache/
|
|
8
|
+
*.egg-info/
|
|
9
|
+
build/
|
|
10
|
+
dist/
|
|
11
|
+
.build/
|
|
12
|
+
|
|
13
|
+
# Node / TypeScript
|
|
14
|
+
node_modules/
|
|
15
|
+
*.tsbuildinfo
|
|
16
|
+
coverage/
|
|
17
|
+
npm-dist/
|
|
18
|
+
|
|
19
|
+
# Local secrets (never committed)
|
|
20
|
+
.env
|
|
21
|
+
.env.*
|
|
22
|
+
*.pem
|
|
23
|
+
*.key
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: originalpictures-sdk
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Python SDK for C2PA Content Credentials: sign, invisibly watermark, fingerprint and verify media.
|
|
5
|
+
Project-URL: Homepage, https://originalpictures.com
|
|
6
|
+
Project-URL: Documentation, https://docs.originalpictures.com/sdk/python/
|
|
7
|
+
Project-URL: Repository, https://github.com/Original-Pictures/originalpictures-clients
|
|
8
|
+
Project-URL: Issues, https://github.com/Original-Pictures/originalpictures-clients/issues
|
|
9
|
+
Project-URL: Pricing, https://originalpictures.com/pricing/
|
|
10
|
+
Author-email: "Original Pictures Technologies, Inc." <hello@originalpictures.com>
|
|
11
|
+
License-Expression: Apache-2.0
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: ai-labeling,ai-watermarking,api-client,c2pa,content-credentials,eu-ai-act,fingerprinting,invisible-watermark,perceptual-hash,provenance,sb-942,sdk,verification,watermarking
|
|
14
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Topic :: Multimedia
|
|
23
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
24
|
+
Classifier: Topic :: Multimedia :: Sound/Audio
|
|
25
|
+
Classifier: Topic :: Multimedia :: Video
|
|
26
|
+
Classifier: Topic :: Security :: Cryptography
|
|
27
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
28
|
+
Classifier: Typing :: Typed
|
|
29
|
+
Requires-Python: >=3.12
|
|
30
|
+
Requires-Dist: httpx==0.28.1
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
# originalpictures-sdk: Python SDK for C2PA Content Credentials, AI watermarking and verification
|
|
34
|
+
|
|
35
|
+
`originalpictures-sdk` is the official, typed Python client for the
|
|
36
|
+
[Original Pictures](https://originalpictures.com) API. Use it to sign images, audio, video and
|
|
37
|
+
documents with C2PA Content Credentials, add an invisible watermark and perceptual fingerprints,
|
|
38
|
+
and verify what a file declares about its origin.
|
|
39
|
+
|
|
40
|
+
It covers all 128 operations in the public API contract with generated types. Its synchronous and
|
|
41
|
+
asynchronous clients execute the 126 consumer operations; the two provider-ingress operations
|
|
42
|
+
(Clerk and Stripe callbacks) stay typed but are deliberately non-callable, because their signatures
|
|
43
|
+
cover exact raw bytes that a JSON client must not re-encode.
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from originalpictures import Client
|
|
47
|
+
|
|
48
|
+
with Client(base_url="https://api.originalpictures.com", api_key="opk_...") as client:
|
|
49
|
+
me = client.get_current_user()
|
|
50
|
+
capabilities = client.get_capabilities()
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## What it does
|
|
54
|
+
|
|
55
|
+
- **C2PA signing.** Every signing job writes a C2PA manifest (Content Credentials) into the file,
|
|
56
|
+
or beside it for sidecar formats, following the C2PA Technical Specification 2.4. The manifest
|
|
57
|
+
records the file's declared origin: who signed it, with which tool, and what actions were
|
|
58
|
+
declared.
|
|
59
|
+
- **Invisible watermark.** Optionally embeds an invisible watermark before signing, so a copy
|
|
60
|
+
whose metadata was stripped can still be matched to your record.
|
|
61
|
+
- **Perceptual fingerprinting.** Optionally keeps server-side fingerprints of the signed output
|
|
62
|
+
for recovery by similarity.
|
|
63
|
+
- **AI-generation declaration.** Records that a generative model produced the file
|
|
64
|
+
(`c2pa.created` with an IPTC digital source type such as `trainedAlgorithmicMedia`). This is
|
|
65
|
+
the kind of machine-readable marking that EU AI Act Article 50(2) and the California AI
|
|
66
|
+
Transparency Act (SB 942, as amended by AB 853) describe.
|
|
67
|
+
- **Verification.** Checks Content Credentials, the certificate chain and your account's records,
|
|
68
|
+
and reports the file's declared origin with reason codes. It is never a judgement about the
|
|
69
|
+
content itself.
|
|
70
|
+
- **Public verify pages.** `verify_public()` checks a file against an account's public verify
|
|
71
|
+
page without an API key.
|
|
72
|
+
- **Webhooks.** `verify_webhook()` checks Standard Webhooks signatures on raw request bodies.
|
|
73
|
+
|
|
74
|
+
## Why use it
|
|
75
|
+
|
|
76
|
+
- Fully typed (`py.typed`): every request body, parameter and response is a `TypedDict`, so
|
|
77
|
+
mypy and Pyright catch a misspelled field before the request is sent.
|
|
78
|
+
- Safe transfers: `upload_file` and `download_file` stream bytes and finish only after the
|
|
79
|
+
expected length and SHA-256 match. API authorization is never forwarded to upload or download
|
|
80
|
+
URLs.
|
|
81
|
+
- Bounded by default: response size limits, request timeouts, and polling helpers with a wall
|
|
82
|
+
deadline and cooperative cancellation.
|
|
83
|
+
- Stable, typed errors (`AuthenticationError`, `RateLimitError`, `ConflictError` and others)
|
|
84
|
+
carrying the API's reason `code` and `request_id`.
|
|
85
|
+
- One dependency: `httpx`.
|
|
86
|
+
|
|
87
|
+
## Install
|
|
88
|
+
|
|
89
|
+
```sh
|
|
90
|
+
pip install originalpictures-sdk
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Or with uv:
|
|
94
|
+
|
|
95
|
+
```sh
|
|
96
|
+
uv add originalpictures-sdk
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Requires Python 3.12 or later.
|
|
100
|
+
|
|
101
|
+
## Quickstart: sign a file
|
|
102
|
+
|
|
103
|
+
Get an API key from the [console](https://console.originalpictures.com/) (keys start with
|
|
104
|
+
`opk_`). Upload the bytes, then accept a signing job for the asset.
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
import hashlib
|
|
108
|
+
import os
|
|
109
|
+
from pathlib import Path
|
|
110
|
+
|
|
111
|
+
from originalpictures import Client, idempotency_key, poll, sign_job_terminal
|
|
112
|
+
|
|
113
|
+
path = Path("photo.jpg")
|
|
114
|
+
digest = hashlib.sha256(path.read_bytes()).hexdigest()
|
|
115
|
+
|
|
116
|
+
with Client(
|
|
117
|
+
base_url="https://api.originalpictures.com",
|
|
118
|
+
api_key=os.environ["ORIGINALPICTURES_API_KEY"],
|
|
119
|
+
) as client:
|
|
120
|
+
upload = client.create_upload(
|
|
121
|
+
body={
|
|
122
|
+
"byte_length": path.stat().st_size,
|
|
123
|
+
"declared_media_type": "image/jpeg",
|
|
124
|
+
"mode": "single",
|
|
125
|
+
"sha256": digest,
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
target = upload.get("upload")
|
|
129
|
+
if target is None:
|
|
130
|
+
raise RuntimeError("a single-mode upload returns one presigned request")
|
|
131
|
+
client.upload_file(target["url"], path, sha256=digest, headers=target["headers"])
|
|
132
|
+
client.complete_upload(
|
|
133
|
+
body={},
|
|
134
|
+
parameters={"upload_id": upload["upload_id"]},
|
|
135
|
+
headers={"Idempotency-Key": idempotency_key()},
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
# C2PA only: no watermark and no fingerprint.
|
|
139
|
+
job = client.accept_signing_job(
|
|
140
|
+
body={"asset_id": upload["asset_id"], "watermark": False, "fingerprint": False},
|
|
141
|
+
headers={"Idempotency-Key": idempotency_key()},
|
|
142
|
+
)
|
|
143
|
+
signed = poll(
|
|
144
|
+
lambda: client.get_job(parameters={"job_id": job["job_id"]}),
|
|
145
|
+
sign_job_terminal,
|
|
146
|
+
timeout=300,
|
|
147
|
+
)
|
|
148
|
+
print(signed["state"], signed["recipe_id"])
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
`sign_job_terminal` is the completion test for `job_...` Sign snapshots. It fails closed on
|
|
152
|
+
identifier or readiness drift: a completed Sign result must carry a ready `vfy_...` evidence ID.
|
|
153
|
+
Use `verification_job_terminal` for `vjob_...` public Verify jobs; a `vjob_...` is only a pollable
|
|
154
|
+
job and never immutable evidence.
|
|
155
|
+
|
|
156
|
+
## Choose what a signing job adds
|
|
157
|
+
|
|
158
|
+
Every job signs with C2PA. Two flags choose what else it does (an omitted flag means `false`):
|
|
159
|
+
|
|
160
|
+
| You want | Request fields |
|
|
161
|
+
| ---------------------------------------- | -------------------------------------- |
|
|
162
|
+
| C2PA Content Credentials only | `watermark: false, fingerprint: false` |
|
|
163
|
+
| An invisible watermark, then C2PA | `watermark: true` |
|
|
164
|
+
| A watermark and a fingerprint, then C2PA | `watermark: true, fingerprint: true` |
|
|
165
|
+
| A fingerprint, then C2PA | `fingerprint: true` |
|
|
166
|
+
|
|
167
|
+
Send both flags every time (only an older key with legacy defaults may leave them out). The job
|
|
168
|
+
reports the exact `recipe_id` it ran. Integrations that already send a `recipe_id` keep working; a
|
|
169
|
+
flag sent with it must agree with that recipe or the request is refused.
|
|
170
|
+
|
|
171
|
+
## Examples
|
|
172
|
+
|
|
173
|
+
### 1. Add an invisible watermark and fingerprints
|
|
174
|
+
|
|
175
|
+
```python
|
|
176
|
+
watermarked = client.accept_signing_job(
|
|
177
|
+
body={"asset_id": asset_id, "watermark": True},
|
|
178
|
+
headers={"Idempotency-Key": idempotency_key()},
|
|
179
|
+
)
|
|
180
|
+
fingerprinted = client.accept_signing_job(
|
|
181
|
+
body={"asset_id": asset_id, "watermark": True, "fingerprint": True},
|
|
182
|
+
headers={"Idempotency-Key": idempotency_key()},
|
|
183
|
+
)
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Each job is a separate signing of the asset. A watermark request accepts only media types that
|
|
187
|
+
the deployment supports for watermarking; `client.get_capabilities()` lists them.
|
|
188
|
+
|
|
189
|
+
### 2. Declare AI generation (EU AI Act Article 50, SB 942)
|
|
190
|
+
|
|
191
|
+
To declare that a generative model produced the file, add `ai_declaration` and keep
|
|
192
|
+
`"watermark": False`. A watermark together with an AI declaration is refused with
|
|
193
|
+
`JOB_POLICY_REJECTED` and `detail_code` `AI_DECLARATION_REQUIRES_SIGN_ONLY`.
|
|
194
|
+
|
|
195
|
+
```python
|
|
196
|
+
job = client.accept_signing_job(
|
|
197
|
+
body={
|
|
198
|
+
"asset_id": asset_id,
|
|
199
|
+
"watermark": False,
|
|
200
|
+
"fingerprint": True,
|
|
201
|
+
"ai_declaration": {
|
|
202
|
+
"software_agent_name": "Studio Nova Imagine",
|
|
203
|
+
"software_agent_version": "2.0",
|
|
204
|
+
"digital_source_type": "trainedAlgorithmicMedia",
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
headers={"Idempotency-Key": idempotency_key()},
|
|
208
|
+
)
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### 3. Download the signed file with integrity checks
|
|
212
|
+
|
|
213
|
+
```python
|
|
214
|
+
result = signed["result"]
|
|
215
|
+
if result is None:
|
|
216
|
+
raise RuntimeError("the job did not publish an asset")
|
|
217
|
+
grant = client.create_asset_download(parameters={"asset_id": result["asset_id"]})
|
|
218
|
+
client.download_file(
|
|
219
|
+
grant["url"],
|
|
220
|
+
Path("photo.signed.jpg"),
|
|
221
|
+
byte_length=grant["byte_length"],
|
|
222
|
+
sha256=grant["sha256"],
|
|
223
|
+
headers=grant["headers"],
|
|
224
|
+
)
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
The download URL is a short-lived bearer capability: keep it out of logs. The file is written to a
|
|
228
|
+
temporary name and moved into place only after its length and SHA-256 match.
|
|
229
|
+
|
|
230
|
+
### 4. Check a file on a public verify page (no API key)
|
|
231
|
+
|
|
232
|
+
```python
|
|
233
|
+
from originalpictures import verify_public
|
|
234
|
+
|
|
235
|
+
result = verify_public("photo.jpg", page="studio-nova")
|
|
236
|
+
print(result["content_credentials"]["status"], result["made_with"]["answer"])
|
|
237
|
+
print(result["statement"])
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
`verify_public` states what the file declares about its origin and whether the page owner's
|
|
241
|
+
system has a record of it. Show the result's `statement` with it. A file may be at most 25 MB, and
|
|
242
|
+
a running check is polled every 2 seconds. `verify_public_async` is the asynchronous form,
|
|
243
|
+
`fetch_verify_page("studio-nova")` reads the page's public settings, and
|
|
244
|
+
`Client.verify_public(slug, file)` does the same on an existing client. Each check is billed to the
|
|
245
|
+
page owner.
|
|
246
|
+
|
|
247
|
+
### 5. Verify a webhook delivery
|
|
248
|
+
|
|
249
|
+
```python
|
|
250
|
+
from originalpictures import RequestValidationError, verify_webhook
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
def handle(raw_body: bytes, headers: dict[str, str], secret: str) -> bool:
|
|
254
|
+
try:
|
|
255
|
+
verify_webhook(
|
|
256
|
+
raw_body,
|
|
257
|
+
secret=secret, # the whsec_... value shown once when the endpoint was created
|
|
258
|
+
event_id=headers["webhook-id"],
|
|
259
|
+
timestamp=headers["webhook-timestamp"],
|
|
260
|
+
signature=headers["webhook-signature"],
|
|
261
|
+
)
|
|
262
|
+
except RequestValidationError:
|
|
263
|
+
return False
|
|
264
|
+
return True
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Pass the exact raw request bytes: parsing and re-serializing the JSON first invalidates the HMAC.
|
|
268
|
+
Several space-delimited signatures are accepted during secret rotation.
|
|
269
|
+
|
|
270
|
+
### 6. Async client and error handling
|
|
271
|
+
|
|
272
|
+
```python
|
|
273
|
+
import asyncio
|
|
274
|
+
|
|
275
|
+
from originalpictures import AsyncClient, RateLimitError
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
async def recent_assets() -> None:
|
|
279
|
+
async with AsyncClient(
|
|
280
|
+
base_url="https://api.originalpictures.com", api_key="opk_..."
|
|
281
|
+
) as client:
|
|
282
|
+
try:
|
|
283
|
+
page = await client.list_assets(parameters={"limit": 20})
|
|
284
|
+
except RateLimitError as error:
|
|
285
|
+
print("retry later", error.code, error.request_id)
|
|
286
|
+
return
|
|
287
|
+
for item in page["items"]:
|
|
288
|
+
print(item["asset_id"])
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
asyncio.run(recent_assets())
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
## Configuration
|
|
295
|
+
|
|
296
|
+
| Setting | Where | Default |
|
|
297
|
+
| ------------------- | ---------------------------------- | -------------------------------------------- |
|
|
298
|
+
| API origin | `Client(base_url=...)` | none; use `https://api.originalpictures.com` |
|
|
299
|
+
| API key | `Client(api_key=...)` | none; read it from your secret store |
|
|
300
|
+
| Request timeout | `Client(timeout=...)` (seconds) | `30.0` |
|
|
301
|
+
| JSON response bound | `Client(max_response_bytes=...)` | `DEFAULT_MAX_RESPONSE_BYTES` (16 MiB) |
|
|
302
|
+
| Custom HTTP client | `Client(http_client=httpx.Client)` | a private `httpx.Client` |
|
|
303
|
+
| Public check origin | `verify_public(..., api_base=...)` | `https://api.originalpictures.com` |
|
|
304
|
+
|
|
305
|
+
The SDK reads no environment variables itself; the examples use `ORIGINALPICTURES_API_KEY` by
|
|
306
|
+
convention, the same name the CLI and MCP server read. Do not put API keys in command arguments or
|
|
307
|
+
logs. API base URLs may include a path prefix, which is preserved; query strings and fragments are
|
|
308
|
+
rejected locally before any request or credential is sent.
|
|
309
|
+
|
|
310
|
+
`poll_async` cancels an in-flight coroutine at its wall deadline. `poll` runs each fetch in one of at
|
|
311
|
+
most eight daemon workers and never queues work; when all are busy, new polls fail with
|
|
312
|
+
`PollingCapacityError`. Give callbacks a finite I/O timeout no longer than the poll budget.
|
|
313
|
+
|
|
314
|
+
## FAQ
|
|
315
|
+
|
|
316
|
+
**Is this C2PA?**
|
|
317
|
+
Yes. Signing writes standard C2PA manifests (Content Credentials) that any C2PA-aware validator,
|
|
318
|
+
such as `c2patool`, can read. Original Pictures is listed on the C2PA Conforming Products List as a
|
|
319
|
+
generator product under the C2PA Conformance Program 0.2 (C2PA Technical Specification 2.4).
|
|
320
|
+
|
|
321
|
+
**Is Original Pictures audited?**
|
|
322
|
+
Original Pictures Technologies, Inc. holds ISO/IEC 27001:2022 certification for its information
|
|
323
|
+
security management system (GCAI, certificate GCAI-ISMS-PD91) and ISO/IEC 42001:2023 certification
|
|
324
|
+
for its AI management system (TNV). It has a SOC 2 Type I report from Percilchofe CPA LLC as of
|
|
325
|
+
19 October 2026, and runs a GDPR compliance program. The certifications cover management systems,
|
|
326
|
+
not this package. See [Security and compliance](https://originalpictures.com/security/).
|
|
327
|
+
|
|
328
|
+
**Does it store my media?**
|
|
329
|
+
Files you upload are processed on Original Pictures' private servers, encrypted in transit and at
|
|
330
|
+
rest, in isolated processing. Published outputs are kept for the retention your API key selects
|
|
331
|
+
(`1h`, `24h`, `72h` or `retain`; new accounts default to 72 hours). Operator views show metadata
|
|
332
|
+
only, and emergency access is audited. This is private server processing, not end-to-end
|
|
333
|
+
encryption. See [Retention and pricing](https://docs.originalpictures.com/api/retention-pricing/).
|
|
334
|
+
|
|
335
|
+
**What formats are supported?**
|
|
336
|
+
Embedded C2PA for JPEG, PNG, WebP, TIFF, AVIF, WAV, MP3, AAC (`.m4a`) and MP4 (H.264/AAC).
|
|
337
|
+
Sign-only embedding for GIF, JPEG XL, SVG, DNG, HEIC/HEIF, QuickTime, AVI and FLAC. A sidecar
|
|
338
|
+
`.c2pa` manifest for PDF, EPUB, DOCX, text, fonts and ML model files. Watermarks and fingerprints
|
|
339
|
+
apply only to media types that can be decoded. `client.get_capabilities()` returns the live list;
|
|
340
|
+
see [Supported media](https://docs.originalpictures.com/introduction/).
|
|
341
|
+
|
|
342
|
+
**Does a watermark replace C2PA?**
|
|
343
|
+
No. C2PA records declared origin in metadata; the watermark and fingerprints help find your record
|
|
344
|
+
again when that metadata has been stripped. A file declared as AI-generated is signed without a
|
|
345
|
+
watermark.
|
|
346
|
+
|
|
347
|
+
**Does this make me meet the EU AI Act or SB 942?**
|
|
348
|
+
It produces machine-readable marking of the kind those laws describe. Whether your use meets an
|
|
349
|
+
obligation is a legal question for your counsel; using the SDK does not by itself satisfy any law.
|
|
350
|
+
|
|
351
|
+
**How much does it cost?**
|
|
352
|
+
See [pricing](https://originalpictures.com/pricing/). Signing jobs, watermarks, fingerprints and
|
|
353
|
+
verifications are billable operations.
|
|
354
|
+
|
|
355
|
+
**How do I get an API key?**
|
|
356
|
+
Sign in to the [console](https://console.originalpictures.com/) and create one under **API keys**.
|
|
357
|
+
Give each integration its own key with only the scopes it needs.
|
|
358
|
+
|
|
359
|
+
## Links
|
|
360
|
+
|
|
361
|
+
- Documentation: <https://docs.originalpictures.com/>
|
|
362
|
+
- Python SDK guide: <https://docs.originalpictures.com/sdk/python/>
|
|
363
|
+
- API reference: <https://docs.originalpictures.com/api/>
|
|
364
|
+
- Website: <https://originalpictures.com>
|
|
365
|
+
- Related packages: [`@originalpictures/sdk`](https://www.npmjs.com/package/@originalpictures/sdk)
|
|
366
|
+
(TypeScript), [`originalpictures-cli`](https://pypi.org/project/originalpictures-cli/),
|
|
367
|
+
[`originalpictures-mcp`](https://pypi.org/project/originalpictures-mcp/)
|
|
368
|
+
- Support: <hello@originalpictures.com>
|
|
369
|
+
|
|
370
|
+
## Licence
|
|
371
|
+
|
|
372
|
+
Licensed under the [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0); the
|
|
373
|
+
full text is in the `LICENSE` file shipped with this package. Copyright © 2026 Original Pictures
|
|
374
|
+
Technologies, Inc. The licence grants no rights to the Original Pictures name or logo.
|