Skip to main content

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.

AuthenticateWithClientCredential​

unarysasha.partnerapi.v1.PartnerAPI/AuthenticateWithClientCredential

Grants an application access to a service using client credentials. Returns an access token that can be used to authenticate with the service.

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​

unarysasha.partnerapi.v1.PartnerAPI/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
  • 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_ARGUMENT and creates no job. Every rejected field is named in the error details of that status (see "Validation failures" on the service).
  • jobJobrequired= 1
    The job that was created.

Errors

  • INVALID_ARGUMENT: media_url is missing or not a URL SASHA fetches, media_mime_type is 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 the retry-after trailer.
  • 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​

client streamsasha.partnerapi.v1.PartnerAPI/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_ARGUMENT and creates no job. Every rejected field is named in the error details of that status (see "Validation failures" on the service).
  • jobJobrequired= 1
    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 the retry-after trailer.
  • 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​

unarysasha.partnerapi.v1.PartnerAPI/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.
  • guidance_contextsasha.common.public.GuidanceContextoptional= 4
    The context in which the media was found, used to evaluate the found signature's Record into distribution guidance on the completed job.
  • jobJobrequired= 1
    The job that was created.

Errors

  • INVALID_ARGUMENT: media_url is missing or not a URL SASHA fetches, media_mime_type is 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 the retry-after trailer.
  • 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​

client streamsasha.partnerapi.v1.PartnerAPI/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.
  • guidance_contextsasha.common.public.GuidanceContextoptional= 3
    The context in which the media was found, used to evaluate the found signature's Record into distribution guidance on the completed job.
  • jobJobrequired= 1
    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 the retry-after trailer.
  • 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​

unarysasha.partnerapi.v1.PartnerAPI/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
  • The Record attached to the signature. Unset when the signature has no Record attached.
  • revisionuint64required= 2
    The 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 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.

UpdateSignatureRecord​

unarysasha.partnerapi.v1.PartnerAPI/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.

Source
sasha/partner-api/v1/partner_api.proto:302
  • signature_idsasha.common.public.SignatureIDrequired= 1
    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) and record.<field> for any top-level Record field except c2pa_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 the revision returned by a prior read or write.
  • The Record after the update. Populated only when return_record was set on the request; also unset when the update detached the Record.
  • revisionuint64required= 2
    The signature's revision after the update.

Errors

  • INVALID_ARGUMENT if the resulting Record violates the consistency rules documented on sasha.common.public.Record, the supplied Record sets c2pa_manifest_store, or update_mask names 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 in update_mask (see "Validation failures" on the service). A rule that can only be decided against the merged Record — a distribution field whose share_state the update does not also supply, say — is left to the stored Record and reported with the status message alone.
  • NOT_FOUND if the signature does not exist or was not registered by the calling partner.
  • FAILED_PRECONDITION if the signature is revoked.

GetJob​

unarysasha.partnerapi.v1.PartnerAPI/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
  • job_idstringrequired= 1
    The identifier of the job to retrieve.

Response

Job
  • job_idstringrequired= 1
    The ID of the job.
  • typeJob.Typerequired= 2
    The type of the job.
  • statusJob.Statusrequired= 3
    The status of the job.
  • errorJob.Erroroptional= 4
    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.
  • signature_idsasha.common.public.SignatureIDoptional= 7
    The signature identifier, if the job is completed.
  • creator_idgoogle.protobuf.UInt32Valueoptional= 10
    The CreatorID of the business entity that owns the signature in signature_id.
  • guidancesasha.common.public.Guidanceoptional= 11
    SASHA-evaluated distribution guidance for the found signature.
  • recordsasha.common.public.Recordoptional= 12
    A field-filtered Record for the found signature on a completed lookup job.
  • warningsrepeated Job.Warningoptional= 13
    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​

unarysasha.partnerapi.v1.PartnerAPI/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>.

Source
sasha/partner-api/v1/partner_api.proto:334
  • 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 as next_page_token by a previous response. The token is opaque.
  • jobsrepeated Jobrequired= 1
    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 as page_token.

Errors

  • INVALID_ARGUMENT (PAGE_TOKEN_INVALID): page_token is malformed or was not returned as next_page_token. Not retryable; start again without page_token.

WatchJob​

server streamsasha.partnerapi.v1.PartnerAPI/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
  • job_idstringrequired= 1
    The identifier of the job to watch.

Response

WatchJobResponsestream

The response is a stream; every message on it has this shape.

  • jobJobrequired= 1
    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.ErrorInfo detail 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:

  • field Path 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.

  • reason Machine-readable cause, and the only part of a violation to branch on. One of INVALID_FORMAT, UNSUPPORTED_SCHEME, FORBIDDEN_USERINFO, FORBIDDEN_HOST, TOO_LONG, TOO_MANY, INVALID_CHARACTERS, UNKNOWN_VALUE, OUT_OF_RANGE, NOT_ALLOWED_HERE, EXACTLY_ONE_REQUIRED, EMPTY or INVALID_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.

  • description Human-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.