PartnerAPI gRPC service
sasha.partnerapi.v1.PartnerAPI · sasha/partner-api/v1/partner_api.proto:104 · 10 RPCs
Service for Partners working with SASHA Signature.
What applies to every RPC is described after the RPCs: Authentication and Error handling.
9 of these RPCs have operations in the REST API, linked from each.
Every RPC below carries a buf curl command. It needs buf installed and finds the schema through the server's reflection. Set $TOKEN to an access token from AuthenticateWithClientCredential.
- Production
- partner.api.sasha.eu
- AuthenticateWithClientCredentialunaryGrants an application access to a service using client credentials. Returns an access token that can be used to authenticate with the service.
- EmbedSignatureFromURLunarySend a request to embed a SASHA Signature into the given media content.
- EmbedSignatureFromDataclient streamSend a request to embed a SASHA Signature into the given media content.
- LookupSignatureFromURLunarySend a request to lookup a SASHA Signature from the given media content.
- LookupSignatureFromDataclient streamSend a request to lookup a SASHA Signature from the given media content.
- GetSignatureRecordunaryReturns the Record attached to a signature registered by the calling partner, along with the signature's current revision.
- UpdateSignatureRecordunaryReplaces the Record attached to a Signature and returns the signature's new revision (and, when
return_recordis set, the updated Record). - GetJobunaryGets a job by its ID.
- ListJobsunaryLists the calling partner's recent jobs, newest first, one page at a time.
- WatchJobserver streamStreams the state of a job until it finishes.
AuthenticateWithClientCredential
Grants an application access to a service using client credentials. Returns an access token that can be used to authenticate with the service.
- REST
- Source
- sasha/partner-api/v1/partner_api.proto:111
- client_
idstringrequired= 1 Client ID of the application that accesses the service. - client_
secretstringrequired= 2 The client secret of the application that accesses the service.
- access_
tokenstringrequired= 1 The access token for the authenticated client. - expires_
inuint32required= 2 Lifetime of the access token in seconds from the time of issuance.
Errors
No failure modes documented.
EmbedSignatureFromURL
Send a request to embed a SASHA Signature into the given media content.
Authentication required:
Bearer token issued by PartnerAPI.AuthenticateWithClientCredential,
passed in the "Authorization" metadata with the format Bearer <token>.
- Source
- sasha/partner-api/v1/partner_api.proto:149
Request
EmbedSignatureFromURLRequest- media_
urlstringrequired= 2 The URL of the media file to protect by embedding the SASHA Signature into. - media_
mime_ typegoogle. protobuf. StringValueoptional= 3 The MIME type of the media file at the given URL. - A Record to attach to the resulting signature. Validated at submit; an invalid Record fails the request with
INVALID_ARGUMENTand creates no job. Every rejected field is named in the error details of that status (see "Validation failures" on the service).
Response
EmbedSignatureFromURLResponse- The job that was created.
Errors
INVALID_ARGUMENT:media_urlis missing or not a URL SASHA fetches,media_mime_typeis not supported, the Record is invalid (see "Validation failures" on the service), no media type is given and the server's response does not name one, or the media could not be downloaded. No job was created. Not retryable, except a failed download, which can be retried once.PERMISSION_DENIED: the media is a video and the partner is not granted video embedding. Not retryable.RESOURCE_EXHAUSTED: the media is a video and the partner already has as many video jobs in progress as it is allowed. No job was created. Retry once one of those jobs has finished.UNAVAILABLE(MEDIA_STAGING_FULL): the media is an image, and SASHA is holding as much submitted media as it can until jobs already accepted finish processing. A video submitted by URL is never refused this way. The request is valid and no job was created, so sending the same request again cannot create a second job. Retry after the number of seconds in theretry-aftertrailer.UNAVAILABLE: a temporary failure. The job may already have been created, so a retry can create a second job and register a second Signature. Retry only if that is acceptable.INTERNAL: a SASHA fault. Not retryable.
EmbedSignatureFromData
Send a request to embed a SASHA Signature into the given media content.
Authentication required:
Bearer token issued by PartnerAPI.AuthenticateWithClientCredential,
passed in the "Authorization" metadata with the format Bearer <token>.
- Source
- sasha/partner-api/v1/partner_api.proto:175
The client sends a stream; every message on it has this shape.
- media_
data_ chunkbytesrequired= 1 The media file to protect by embedding the SASHA Signature into. - media_
mime_ typestringrequired= 2 The MIME type of the media data. - A Record to attach to the resulting signature. Validated at submit; an invalid Record fails the request with
INVALID_ARGUMENTand creates no job. Every rejected field is named in the error details of that status (see "Validation failures" on the service).
Response
EmbedSignatureFromDataResponse- The job that was created.
Errors
INVALID_ARGUMENT: no media data or no media type was sent, the chunks name different media types, the media type is not supported, the media is larger than the size limit, the stream holds more messages than one per KiB of the size limit, or the Record is invalid (see "Validation failures" on the service). No job was created. Not retryable.UNAVAILABLE(MEDIA_STAGING_FULL): the media is an image, and SASHA is holding as much submitted media as it can until jobs already accepted finish processing. A video submitted by URL is never refused this way. The request is valid and no job was created, so sending the same request again cannot create a second job. Retry after the number of seconds in theretry-aftertrailer.UNAVAILABLE: a temporary failure. The job may already have been created, so a retry can create a second job and register a second Signature. Retry only if that is acceptable.INTERNAL: a SASHA fault. Not retryable.
LookupSignatureFromURL
Send a request to lookup a SASHA Signature from the given media content.
Authentication required:
Bearer token issued by PartnerAPI.AuthenticateWithClientCredential,
passed in the "Authorization" metadata with the format Bearer <token>.
- Source
- sasha/partner-api/v1/partner_api.proto:210
- media_
urlstringrequired= 2 The URL of the media file to lookup the SASHA Signature from. - media_
mime_ typegoogle. protobuf. StringValueoptional= 3 The MIME type of the media file at the given URL. - The context in which the media was found, used to evaluate the found signature's Record into distribution guidance on the completed job.
Response
LookupSignatureFromURLResponse- The job that was created.
Errors
INVALID_ARGUMENT:media_urlis missing or not a URL SASHA fetches,media_mime_typeis not supported, no media type is given and the server's response does not name one, or the media could not be downloaded. No job was created. Not retryable, except a failed download, which can be retried once.PERMISSION_DENIED: the media is a video and the partner is not granted video lookup. Not retryable.RESOURCE_EXHAUSTED: the media is a video and the partner already has as many video jobs in progress as it is allowed. No job was created. Retry once one of those jobs has finished.UNAVAILABLE(MEDIA_STAGING_FULL): the media is an image, and SASHA is holding as much submitted media as it can until jobs already accepted finish processing. A video submitted by URL is never refused this way. The request is valid and no job was created, so sending the same request again cannot create a second job. Retry after the number of seconds in theretry-aftertrailer.UNAVAILABLE: a temporary failure. The job may already have been created, so a retry can create a second job. Retry only if that is acceptable.INTERNAL: a SASHA fault. Not retryable.
LookupSignatureFromData
Send a request to lookup a SASHA Signature from the given media content.
Authentication required:
Bearer token issued by PartnerAPI.AuthenticateWithClientCredential,
passed in the "Authorization" metadata with the format Bearer <token>.
- Source
- sasha/partner-api/v1/partner_api.proto:235
The client sends a stream; every message on it has this shape.
- media_
data_ chunkbytesrequired= 1 The media file to lookup the SASHA Signature from. - media_
mime_ typestringrequired= 2 The MIME type of the media data. - The context in which the media was found, used to evaluate the found signature's Record into distribution guidance on the completed job.
Response
LookupSignatureFromDataResponse- The job that was created.
Errors
INVALID_ARGUMENT: no media data or no media type was sent, the chunks name different media types, the media type is not supported, the media is larger than the size limit, or the stream holds more messages than one per KiB of the size limit. No job was created. Not retryable.UNAVAILABLE(MEDIA_STAGING_FULL): the media is an image, and SASHA is holding as much submitted media as it can until jobs already accepted finish processing. A video submitted by URL is never refused this way. The request is valid and no job was created, so sending the same request again cannot create a second job. Retry after the number of seconds in theretry-aftertrailer.UNAVAILABLE: a temporary failure. The job may already have been created, so a retry can create a second job. Retry only if that is acceptable.INTERNAL: a SASHA fault. Not retryable.
GetSignatureRecord
Returns the Record attached to a signature registered by the calling partner, along with the signature's current revision.
A signature with no Record attached is returned with record unset (it
is not a NOT_FOUND). "Signature does not exist" and "not registered by
the calling partner" both return a uniform NOT_FOUND, so this cannot be
used as an existence oracle over other partners' signatures. A
field-filtered Record may also be returned via a lookup job to the owning
partner or an authorized grantee. To change the Record, use
UpdateSignatureRecord.
Authentication required:
Bearer token issued by PartnerAPI.AuthenticateWithClientCredential,
passed in the "Authorization" metadata with the format Bearer <token>.
Requires the same partner permission as submitting embed jobs.
- Source
- sasha/partner-api/v1/partner_api.proto:257
Request
GetSignatureRecordRequest- The signature whose Record to return.
Response
GetSignatureRecordResponse- The Record attached to the signature. Unset when the signature has no Record attached.
- revisionuint64required= 2The signature's current revision. Callers may use it for change detection and optimistic concurrency.
Errors
Status codes named in the description, with the sentence that names each. Mentions, not declarations.
- NOT_FOUNDA signature with no Record attached is returned with
recordunset (it is not aNOT_FOUND). "Signature does not exist" and "not registered by the calling partner" both return a uniformNOT_FOUND, so this cannot be used as an existence oracle over other partners' signatures.
UpdateSignatureRecord
Replaces the Record attached to a Signature and returns the signature's
new revision (and, when return_record is set, the updated Record).
Only parts named in update_mask are changed; each named part is
replaced wholesale (no sub-field merging). Naming record in the mask
with its value left unset detaches the Record from the signature (metadata
only; the signature remains valid and reverts to the default
"no Record = private" interpretation). May be called for any signature the
partner has registered, regardless of when it was registered. Idempotent:
replaying the same patch is a no-op beyond the revision bump.
Supported mask paths: record and record.<field> for any top-level
Record field except c2pa_manifest_store (replaces only the named
fields; repeated and map fields are replaced wholesale; a path named with
its value unset clears that field). Sub-field updates apply against the
currently attached Record (or an empty one when none is attached), and
the resulting Record must satisfy the consistency rules.
The Record's c2pa_manifest_store field is not supported on this surface
and must be left unset; storing a C2PA manifest store is done via the SDK
API.
Authentication required:
Bearer token issued by PartnerAPI.AuthenticateWithClientCredential,
passed in the "Authorization" metadata with the format Bearer <token>.
Requires the same partner permission as submitting embed jobs.
- REST
- Source
- sasha/partner-api/v1/partner_api.proto:302
Request
UpdateSignatureRecordRequest- The signature whose Record to update.
- Carries the new values for the parts named in
update_mask. Output-only Record fields are ignored. - update_
maskgoogle. protobuf. FieldMaskrequired= 3 The parts to replace. Supported paths:record(a path present with its value unset detaches the Record) andrecord.<field>for any top-level Record field exceptc2pa_manifest_store(replaces only that field; unset value clears it). - return_
recordbooloptional= 4 When true, the response includes the Record after the update. Defaults to false to keep the response small: a Record may be large. - expected_
revisionoptional uint64optional= 5 Optimistic-concurrency precondition. When set, the update is applied only if the signature's current revision equals this value; otherwise it is rejected with FAILED_PRECONDITION and the caller should re-read the Record (GetSignatureRecord) and retry. Omit for last-write-wins. Pair it with therevisionreturned by a prior read or write.
Response
UpdateSignatureRecordResponse- The Record after the update. Populated only when
return_recordwas set on the request; also unset when the update detached the Record. - revisionuint64required= 2The signature's revision after the update.
Errors
INVALID_ARGUMENTif the resulting Record violates the consistency rules documented onsasha.common.public.Record, the supplied Record setsc2pa_manifest_store, orupdate_masknames an unknown or immutable path. A field the update writes and that is wrong on its own terms is named in the error details, with the path it carries inupdate_mask(see "Validation failures" on the service). A rule that can only be decided against the merged Record — a distribution field whoseshare_statethe update does not also supply, say — is left to the stored Record and reported with the status message alone.NOT_FOUNDif the signature does not exist or was not registered by the calling partner.FAILED_PRECONDITIONif the signature is revoked.
GetJob
Gets a job by its ID.
Authentication required:
Bearer token issued by PartnerAPI.AuthenticateWithClientCredential,
passed in the "Authorization" metadata with the format Bearer <token>.
- Source
- sasha/partner-api/v1/partner_api.proto:316
Request
GetJobRequest- job_
idstringrequired= 1 The identifier of the job to retrieve.
Response
Job- job_
idstringrequired= 1 The ID of the job. - The type of the job.
- The status of the job.
- The error that occurred while processing the job, if the job is failed.
- output_
urlgoogle. protobuf. StringValueoptional= 5 The URL of the result media file. - output_
url_ expires_ atgoogle. protobuf. Timestampoptional= 6 The date and time the output URL will expire. - The signature identifier, if the job is completed.
- creator_
idgoogle. protobuf. UInt32Valueoptional= 10 The CreatorID of the business entity that owns the signature insignature_id. - SASHA-evaluated distribution guidance for the found signature.
- A field-filtered Record for the found signature on a completed lookup job.
- What the job left out of its result, or where the result differs from the input, without failing.
- created_
atgoogle. protobuf. Timestamprequired= 8 The date and time the job was created. - updated_
atgoogle. protobuf. Timestamprequired= 9 The date and time the job was last updated.
Errors
No failure modes documented.
ListJobs
Lists the calling partner's recent jobs, newest first, one page at a time.
Results are paginated. Page through with page_token until a response
comes back without next_page_token.
Authentication required:
Bearer token issued by PartnerAPI.AuthenticateWithClientCredential,
passed in the "Authorization" metadata with the format Bearer <token>.
- REST
- Source
- sasha/partner-api/v1/partner_api.proto:334
Request
ListJobsRequest- page_
sizeoptional uint32optional= 1 Maximum number of jobs per page. At most 100; a larger value is clamped to 100. - page_
tokenoptional stringoptional= 2 Pagination cursor returned asnext_page_tokenby a previous response. The token is opaque.
Response
ListJobsResponse- The jobs of this page: recent jobs submitted by the calling partner, each with its current status. Empty when the partner has no recent jobs.
- next_
page_ tokenoptional stringoptional= 2 Cursor for the next page, to be sent back aspage_token.
Errors
INVALID_ARGUMENT(PAGE_TOKEN_INVALID):page_tokenis malformed or was not returned asnext_page_token. Not retryable; start again withoutpage_token.
WatchJob
Streams the state of a job until it finishes.
The stream sends the job's current state first, then the job each time it
changes. It closes after sending the job in STATUS_COMPLETED or
STATUS_FAILED.
The stream can also end before the job finishes, for example on a network
break or when the call reaches the server's time limit for one call. Call
WatchJob again to go on watching: it only reads the job, so calling it
again is safe.
Authentication required:
Bearer token issued by PartnerAPI.AuthenticateWithClientCredential,
passed in the "Authorization" metadata with the format Bearer <token>.
- Source
- sasha/partner-api/v1/partner_api.proto:352
Request
WatchJobRequest- job_
idstringrequired= 1 The identifier of the job to watch.
The response is a stream; every message on it has this shape.
- The current state of the watched job.
Errors
No failure modes documented.
Authentication
All registered Partners are assigned a client_id and client_secret
credentials that are provided by SASHA.
Partners must authenticate with the
PartnerAPI.AuthenticateWithClientCredential RPC using their client_id and
client_secret credentials, and then pass the resulting access token in the
"Authorization" metadata with the format Bearer <token>.
Error handling
The service RPCs may return the following errors:
-
Token expired If the token is expired, the service returns an "UNAUTHENTICATED" status code with a
google.rpc.ErrorInfodetail whose reason is "TOKEN_EXPIRED" and whose domain is "partner-api.sasha.eu". Obtain a new token and retry the call. -
Token not provided If the token is not provided in the "Authorization" metadata, the service returns an "UNAUTHENTICATED" status code.
-
Invalid token If the provided token is invalid, the service returns an "UNAUTHENTICATED" status code with the message starting with "Invalid token".
-
Insufficient permissions If the token does not grant the required permission for the called RPC, the service returns a "PERMISSION_DENIED" status code.
A reason named in parentheses in an RPC's # Errors section is sent as a
google.rpc.ErrorInfo with domain partner-api.sasha.eu in the standard
grpc-status-details-bin trailer. Treat a reason you do not recognize as
the general case of its status code.
Validation failures
An INVALID_ARGUMENT caused by field validation also carries the rejected
fields as a google.rpc.BadRequest in the standard grpc-status-details-bin
trailer (see google/rpc/error_details.proto), which mainstream gRPC
libraries decode for you.
Each BadRequest.field_violations entry names one rejected field:
-
fieldPath of the offending field, in proto field naming, rooted at the request. Repeated entries are indexed and map entries are keyed, e.g.record.purchase_url,record.allowed_publish_urls[2],record.custom_fields["asset_id"].string_value. -
reasonMachine-readable cause, and the only part of a violation to branch on. One ofINVALID_FORMAT,UNSUPPORTED_SCHEME,FORBIDDEN_USERINFO,FORBIDDEN_HOST,TOO_LONG,TOO_MANY,INVALID_CHARACTERS,UNKNOWN_VALUE,OUT_OF_RANGE,NOT_ALLOWED_HERE,EXACTLY_ONE_REQUIRED,EMPTYorINVALID_PATTERN. The set is closed but may be extended, so treat an unrecognized value as a generic validation failure rather than failing hard. What each value means is documented at https://developer.sasha.eu/partner-api/concepts/error-handling. -
descriptionHuman-readable explanation of that one violation. English, not localized, and the wording is not stable across releases. It never echoes the submitted value, so it is safe to log.
At most 20 violations are reported. The status message remains the fallback
for a client that does not read the trailer: it is the first violation's
description, suffixed with " (+N more)" when the request has more than one
violation, counted over all violations rather than only the reported ones.
Violations are reported this way for the Record submitted with
EmbedSignatureFromURL, EmbedSignatureFromData and
UpdateSignatureRecord. They are not a guarantee on every
INVALID_ARGUMENT: a rejection that is not about a named Record field —
an unsupported c2pa_manifest_store, an update_mask path that is unknown
or immutable, or a rule an update can only be judged against once merged
with the stored Record — carries the status message alone. Read the details
when they are present rather than requiring them.
field, reason and description carry the same values as the REST
surface's ErrorResponse.details, so an integration that uses both surfaces
branches on one vocabulary. That vocabulary holds three further reasons —
REQUIRED, INVALID_TYPE and UNKNOWN_FIELD — which describe request-body
problems that cannot arise on a typed gRPC request.