### Workspace usage example Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/WorkspaceResource.md Shows how to create a workspace, get its theme, and get its logo. The logo is null when unset. ```kotlin val workspace = client.workspaces.create(CreateWorkspaceRequest(name = "Acme Inc.")) val theme = client.workspaces.getTheme(workspace.id) val logo: ByteArray? = client.workspaces.getLogo(workspace.id) // null when unset ``` -------------------------------- ### Login and MFA verification example Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/AuthenticationResource.md Shows how to call login and handle MfaRequiredException by passing the mfaToken to verifyMfa within 5 minutes. The example uses a sample email and password. ```kotlin try { val session = client.authentication.login(LoginRequest(email = "user@example.com", password = "secret")) val token = session.accessToken } catch (e: MfaRequiredException) { // Pass e.mfaToken to verifyMfa within 5 minutes val session = client.authentication.verifyMfa(MfaVerifyRequest(mfaToken = e.mfaToken, code = "123456")) } ``` -------------------------------- ### List, get, and extract role from template Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/TemplateResource.md Demonstrates listing templates with search and pagination, getting the first template, and retrieving its first role. ```kotlin val page = client.templates.list(ListParams(search = "nda", perPage = 25)) val templateId = page.data.first().id val template = client.templates.get(templateId) val role = template.roles?.firstOrNull() ``` -------------------------------- ### get method signature Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/WorkspaceResource.md Gets a workspace by account ID via GET /v1/accounts/{accountId}. ```kotlin suspend fun get(accountId: String): Workspace ``` -------------------------------- ### Catching ApiException example Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/errors.md Shows how to catch ApiException and inspect statusCode and challenge. The example checks for 404 and insufficient scope, suggesting re-running OAuth with the challenge's scope. ```kotlin try { client.documents.details("missing_doc") } catch (e: ApiException) { if (e.statusCode == 404) { /* not found */ } else if (e.challenge?.isInsufficientScope == true) { /* re-run OAuth with e.challenge.scope */ } } ``` -------------------------------- ### Reviewer Flow Example Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/AssignmentResource.md Example of the reviewer flow: fetch identity verification, check if in review, and approve with a note. ```kotlin // Reviewer flow val review = client.assignments.getIdentityVerification(docId, assignmentId, signerId) if (review.status == IdentityVerificationStatus.IN_REVIEW) { val approved = client.assignments.reviewIdentityVerification( docId, assignmentId, signerId, decision = IdentityReviewDecision.APPROVED, note = "ID verified by ops", ) } ``` -------------------------------- ### getCurrent usage example Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/UserResource.md Example of calling getCurrent and checking if the email is verified before using the profile for document sending. ```kotlin val me = client.users.getCurrent() if (me.isEmailVerified) { // profile is usable for document sending } ``` -------------------------------- ### getLogo method signature Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/WorkspaceResource.md Gets the workspace logo via GET /v1/accounts/{accountId}/logo. Returns null on HTTP 404. ```kotlin suspend fun getLogo(accountId: String): ByteArray? ``` -------------------------------- ### Refresh token usage example Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/OAuthResource.md Example of exchanging an authorization code, creating a workspace client, and persisting the refresh token. The refresh token rotates, so persist it together with the new access token. ```kotlin val tokens = client.oauth.exchangeCode(code, verifier) val workspaceClient = AssinafyClient.create(AssinafyClientConfig(token = tokens.accessToken)) val workspaceId = workspaceClient.workspaces.list().data.first().id // Persist tokens.refreshToken together with the new access token — refresh rotates it. ``` -------------------------------- ### removeMfaMethod usage example Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/AuthenticationResource.md Example showing how to list MFA methods and remove the first one, using a password for re-authentication. The comment notes that removal.isMfaEnabled will be false if it was the only method. ```kotlin val status = client.authentication.listMfaMethods() if (status.methods.isNotEmpty()) { val removal = client.authentication.removeMfaMethod( status.methods.first().id, MfaReauthRequest(password = "current_password"), ) // removal.isMfaEnabled == false if it was the only method } ``` -------------------------------- ### getStats method signature Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/WorkspaceResource.md Gets workspace stats via GET /v1/accounts/{accountId}/stats. Granularity can be 'monthly' or 'daily'; month required for daily. ```kotlin suspend fun getStats( accountId: String, granularity: String? = null, month: String? = null, ): List ``` -------------------------------- ### POST /v1/users/self/mfa/totp Source: https://github.com/assinafy/mobile-android-sdk/blob/main/docs/API_COVERAGE.md Starts TOTP enrollment for the authenticated user. ```APIDOC ## POST /v1/users/self/mfa/totp ### Description Starts TOTP enrollment for the authenticated user. ### Method POST ### Endpoint /v1/users/self/mfa/totp ### Authentication Account ### SDK Method authentication.startTotpEnrollment(label) ``` -------------------------------- ### authentication.startTotpEnrollment Source: https://github.com/assinafy/mobile-android-sdk/blob/main/README.en.md Starts TOTP enrollment for the authenticated user, returning the secret and otpauth URI. ```APIDOC ## authentication.startTotpEnrollment ### Description Starts TOTP enrollment for the authenticated user. Returns the secret and the `otpauth://` URI for a QR code, once. ### Method N/A (SDK method) ### Endpoint N/A ### Parameters #### Request Body - **label** (string) - Required - The label for the TOTP method. ### Request Example ```kotlin client.authentication.startTotpEnrollment(label) ``` ### Response #### Success Response - **secret** (string) - The TOTP secret. - **otpauthUri** (string) - The `otpauth://` URI for QR code generation. ``` -------------------------------- ### Start Identity Verification Session Source: https://github.com/assinafy/mobile-android-sdk/blob/main/README.en.md Starts a new identity verification session for a signer, returning a hosted URL to open in a browser. ```APIDOC ## Start Identity Verification Session ### Description Starts a new identity verification session for a signer, returning a hosted URL to open in a browser. ### Method POST ### Endpoint client.signerDocuments.startIdentityVerification ### Parameters #### Path Parameters - **accessCode** (string) - Required - The access code received through the invitation channel. #### Request Body - **consent** (boolean) - Required - Explicit consent from the signer for biometric processing. ### Request Example ```kotlin val session = client.signerDocuments.startIdentityVerification(accessCode, consent = consentGrantedBySigner) ``` ### Response #### Success Response - **url** (string) - The hosted URL to open in a browser for document and face capture. Contains an access token; do not log. #### Response Example ```json { "url": "https://verify.example.com/session?token=..." } ``` ``` -------------------------------- ### Signing item array JSON example Source: https://github.com/assinafy/mobile-android-sdk/blob/main/docs/API_REFERENCE.md Example JSON body for the sign method's entries parameter, containing an array of SignAssignmentItemRequest objects with itemId, fieldId, pageId, and value fields. ```json [ { "itemId": "item_example", "fieldId": "field_example", "pageId": "page_example", "value": "Approved" } ] ``` -------------------------------- ### getTheme method signature Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/WorkspaceResource.md Gets the workspace theme via GET /v1/accounts/{accountId}/theme. Returns AccountTheme with colors without '#'. ```kotlin suspend fun getTheme(accountId: String): AccountTheme ``` -------------------------------- ### Create assignment example Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/AssignmentResource.md Example of creating a virtual assignment. The request specifies the method as VIRTUAL, a signer reference with email notification at step 1, a message, and an expiration date. The resulting assignment's signingUrls first entry contains the signer's access code, which should be treated as a credential. ```kotlin val assignment = client.assignments.create( documentId = docId, request = CreateAssignmentRequest( method = AssignmentMethod.VIRTUAL, signers = listOf(SignerReference.over(signerId, NotificationMethod.EMAIL, step = 1)), message = "Please review and sign", expiresAt = "2026-12-31T23:59:59Z", ), ) val signingUrl = assignment.signingUrls?.first()?.url // contains the signer's access code ``` -------------------------------- ### get Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/WorkspaceResource.md Retrieves a specific workspace by its account ID. ```APIDOC ## GET /v1/accounts/{accountId} ### Description Fetches the workspace with the given account ID. ### Method GET ### Endpoint /v1/accounts/{accountId} ### Parameters #### Path Parameters - **accountId** (String) - Required - The ID of the workspace to retrieve. ### Response #### Success Response (200) - **Workspace** - The workspace object. #### Response Example { "id": "ws_123", "name": "Acme Inc." } ``` -------------------------------- ### GET /v1/accounts/{accountId}/theme Source: https://github.com/assinafy/mobile-android-sdk/blob/main/docs/API_REFERENCE.md Retrieves the theme settings for a workspace. ```APIDOC ## GET /v1/accounts/{accountId}/theme ### Description Retrieves the theme settings for a workspace. ### Method GET ### Endpoint /v1/accounts/{accountId}/theme ### Parameters #### Path Parameters - **accountId** (string) - Required - The unique identifier of the workspace. ### Response #### Success Response (200) - **data** (AccountTheme) - The theme settings. #### Response Example { "data": {} } ``` -------------------------------- ### startTotpEnrollment(label) Source: https://github.com/assinafy/mobile-android-sdk/blob/main/docs/API_REFERENCE.md Starts TOTP enrollment with an optional label. Returns TotpEnrollment (secret shown once). ```APIDOC ## [POST] /v1/users/self/mfa/totp ### Description Starts TOTP enrollment with an optional label. Returns TotpEnrollment (secret shown once). ### Method POST ### Endpoint /v1/users/self/mfa/totp ### Parameters #### Request Body - **label** (string?) - Optional - A label for the TOTP method. ### Request Example { "label": "My Authenticator" } ### Response #### Success Response (200) - **data** (TotpEnrollment) - The TOTP enrollment details, including the secret (shown once). ``` -------------------------------- ### Creating an AssinafyClient with parameters and config Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/AssinafyClient.md Shows two ways to create a client: using individual parameters (apiKey, accountId) and using the config overload for OAuth/logger/token settings. The config example sets a token, baseUrl, and OAuthConfig. ```kotlin val client = AssinafyClient.create( apiKey = "ass_api_key", accountId = "acc_123", ) // Config overload — needed for OAuth/logger/token settings: val oauthReady = AssinafyClient.create( AssinafyClientConfig( token = "BearerValue...", baseUrl = "https://api.assinafy.com.br/v1", oauth = OAuthConfig(clientId = "pub-1", redirectUri = "https://myapp.com/oauth/callback"), ), ) ``` -------------------------------- ### GET /v1/signers/identity-verification?signer-access-code={code} Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/SignerDocumentResource.md Retrieves the current identity verification status for a signer. Returns whether the verification can start, its status, a URL (which carries a token and should not be logged), expiration time, and completion time. ```APIDOC ## GET /v1/signers/identity-verification?signer-access-code={code} ### Description Retrieves the current identity verification status for a signer. Returns whether the verification can start, its status, a URL (which carries a token and should not be logged), expiration time, and completion time. ### Method GET ### Endpoint /v1/signers/identity-verification?signer-access-code={code} ### Parameters #### Query Parameters - **signer-access-code** (string) - Required - The signer's access code. ### Response #### Success Response (200) - **can_start** (boolean) - True only before a provider session exists or after it expires. - **status** (string) - The verification status. - **url** (string) - The verification URL (carries a token; keep out of logs). - **expires_at** (string) - The expiration timestamp. - **completed_at** (string) - The completion timestamp. ### Notes - `Declined`/`Abandoned` statuses require a new document and assignment, not another session. ### SDK Method ```kotlin suspend fun getIdentityVerification(signerAccessCode: String): SignerIdentityVerification ``` ``` -------------------------------- ### POST /users/self/mfa/totp Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/endpoints.md Starts TOTP enrollment for the authenticated user. Returns a secret that is shown only once. ```APIDOC ## POST /users/self/mfa/totp ### Description Starts TOTP enrollment for the authenticated user. Returns a secret that is shown only once. ### Method POST ### Endpoint /users/self/mfa/totp ### Authentication Key or Bearer ### Parameters #### Request Body - **label** (string) - Optional - Label for the TOTP method ### Request Example { "label": "My Authenticator" } ### Response #### Success Response (200) - **data** (TotpEnrollment) - Contains secret (once) #### Response Example { "status": "success", "message": "TOTP enrollment started", "data": { "secret": "..." } } ``` -------------------------------- ### Get template and create document from it Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/TemplateResource.md Shows how to fetch a template, extract the first role ID, and create a document from the template with a signer. ```kotlin val template = client.templates.get(templateId) val roleId = template.roles?.first()?.id ?: error("no roles") val doc = client.documents.createFromTemplate( templateId = templateId, signers = listOf(TemplateSigner(roleId = roleId, id = signerId)), ) ``` -------------------------------- ### updateNotificationPreferences usage example Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/UserResource.md Example of updating a single notification preference (documentCompleted) to false. ```kotlin val prefs = client.users.updateNotificationPreferences( UpdateNotificationPreferencesRequest(documentCompleted = false), ) ``` -------------------------------- ### get method signature Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/WebhookResource.md Retrieves the webhook subscription for the account. Returns null on HTTP 404. ```kotlin suspend fun get(accountId: String? = null): WebhookSubscription? ``` -------------------------------- ### Create AssinafyClient with token and account ID Source: https://github.com/assinafy/mobile-android-sdk/blob/main/docs/API_REFERENCE.md Use this snippet to instantiate the SDK client for production or sandbox. The baseUrl must include the /v1 prefix. Credentials must be for the selected environment; do not embed secrets in the APK. ```kotlin val client = AssinafyClient.create( AssinafyClientConfig( token = securelyStoredOAuthAccessToken, accountId = selectedWorkspaceId, baseUrl = "https://api.assinafy.com.br/v1", ) ) ``` -------------------------------- ### get Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/WebhookResource.md Retrieves the webhook subscription for the account. Sends a GET request to /v1/accounts/{accountId}/webhooks/subscriptions. ```APIDOC ## [GET] /v1/accounts/{accountId}/webhooks/subscriptions ### Description Retrieves the webhook subscription for the account. ### Method GET ### Endpoint /v1/accounts/{accountId}/webhooks/subscriptions ### Parameters #### Path Parameters - **accountId** (string) - Optional - The account ID. If not provided, the default account ID is used. ### Response #### Success Response (200) - **WebhookSubscription** - The webhook subscription. #### Response Example { "id": "string", "url": "https://example.com/webhook", "email": "user@example.com", "events": ["event1", "event2"], "isActive": true } #### Error Response (404) Returns null when the subscription is not found. ``` -------------------------------- ### Usage example for listTypes, create, and validate Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/FieldResource.md Shows how to list field types, create a field definition, and validate a value. Throws IllegalStateException if validation fails. ```kotlin val types = client.fields.listTypes() val def = client.fields.create(CreateFieldRequest(name = "Employee CPF", type = "cpf", isRequired = true)) val result = client.fields.validate(def.id, "400.676.228-36") if (!result.success) throw IllegalStateException(result.errorMessage) ``` -------------------------------- ### Prepare OAuth authorization attempt and launch browser Source: https://github.com/assinafy/mobile-android-sdk/blob/main/README.en.md Generates a fresh PKCE pair and state via authorizationRequest(), saves them in the session, and launches a Custom Tab with the authorization URL. Use a full page navigation, never an embedded WebView or AJAX call. ```kotlin val attempt = client.oauth.authorizationRequest() // Keep both in the user's session: steps 2 and 3 need them. session.save(state = attempt.state, verifier = attempt.pkce.codeVerifier) CustomTabsIntent.Builder().build().launchUrl(context, Uri.parse(attempt.url)) ``` -------------------------------- ### AssinafyClient.create Source: https://github.com/assinafy/mobile-android-sdk/blob/main/docs/API_REFERENCE.md Creates an AssinafyClient instance with the provided configuration. The configuration includes authentication token, account ID, and base URL. This is the entry point for all SDK operations. ```APIDOC ## AssinafyClient.create ### Description Creates an AssinafyClient instance with the provided configuration. The configuration includes authentication token, account ID, and base URL. This is the entry point for all SDK operations. ### Method create ### Parameters - **config** (AssinafyClientConfig) - Required - Configuration object containing token, accountId, and baseUrl. ### Request Example ```kotlin val client = AssinafyClient.create( AssinafyClientConfig( token = securelyStoredOAuthAccessToken, accountId = selectedWorkspaceId, baseUrl = "https://api.assinafy.com.br/v1", ) ) ``` ### Response Returns an AssinafyClient instance. ``` -------------------------------- ### Upload, wait, check, and download a document Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/DocumentResource.md Shows the typical workflow: upload PDF bytes, wait until the document is ready, check if fully signed, and download the certificated artifact. ```kotlin val upload = client.documents.upload(pdfBytes, "agreement.pdf") val doc = client.documents.waitUntilReady(upload.id) if (client.documents.isFullySigned(doc.id)) { val finalPdf: ByteArray = client.documents.download(doc.id, DocumentArtifact.CERTIFICATED) } ``` -------------------------------- ### Create document from template with createFromTemplate Source: https://github.com/assinafy/mobile-android-sdk/blob/main/README.en.md Templates produce a document and its assignment in one call. Map one signer to each template role; the signers must already exist. The example selects a ready template and its first role, then creates a document with a template signer and editor field. ```kotlin val template = client.templates.list().data.first { it.status == "ready" } val role = requireNotNull(template.roles).first() val document = client.documents.createFromTemplate( templateId = template.id, signers = listOf(TemplateSigner(roleId = role.id, id = signer.id)), options = CreateDocumentFromTemplateRequest( signers = emptyList(), // replaced by the signers argument name = "Agreement for Ada.pdf", message = "Please review and sign", editorFields = listOf(TemplateEditorField(fieldId = fieldId, value = "Example value")), ), ) ``` -------------------------------- ### AssinafyClient.create(config: AssinafyClientConfig) Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/AssinafyClient.md Creates an AssinafyClient using a complete configuration object for transport, auth, account, logging, webhook, and OAuth settings. ```APIDOC ## AssinafyClient.create(config: AssinafyClientConfig) ### Description Creates a configured AssinafyClient using an `AssinafyClientConfig` object that encapsulates all transport, auth, account, logging, webhook, and OAuth settings. ### Method Factory method (Kotlin companion object) ### Signature ```kotlin fun create(config: AssinafyClientConfig): AssinafyClient ``` ### Parameters - **config** (AssinafyClientConfig) - Required - Complete transport/auth/account/logging/webhook/OAuth settings. ### Returns A configured `AssinafyClient` exposing all SDK resources. ### Throws `ValidationException` when the API key or account ID is blank, both credential types are set, the URL is invalid/insecure for credentials, or the timeout is not positive. ### Example ```kotlin val oauthReady = AssinafyClient.create( AssinafyClientConfig( token = "BearerValue...", baseUrl = "https://api.assinafy.com.br/v1", oauth = OAuthConfig(clientId = "pub-1", redirectUri = "https://myapp.com/oauth/callback"), ), ) ``` ``` -------------------------------- ### Create AssinafyClient with custom logger Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/AssinafyClientConfig.md Shows how to instantiate AssinafyClient with a configuration that includes an API key, account ID, base URL, webhook secret, timeout, and a custom Logger implementation that logs to Android's Log class. ```kotlin val client = AssinafyClient.create( AssinafyClientConfig( apiKey = "ass_key", accountId = "acc_1", baseUrl = "https://api.assinafy.com.br/v1", webhookSecret = "whsec_abc...", // never sent to the API timeoutMs = 30_000L, logger = object : Logger { override fun debug(message: String, context: Map) = Unit override fun info(message: String, context: Map) = Log.i("SDK", "$message $context") override fun warn(message: String, context: Map) = Log.w("SDK", "$message $context") override fun error(message: String, context: Map) = Log.e("SDK", "$message $context") }, ), ) ``` -------------------------------- ### authorizationRequest usage example Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/OAuthResource.md Shows how to create an authorization request, save the state and code verifier, and launch the authorization URL in a Custom Tab. Must be opened with full page navigation, not an in-app WebView. ```kotlin val attempt = client.oauth.authorizationRequest() session.save(attempt.state, attempt.pkce.codeVerifier) CustomTabsIntent.Builder().build().launchUrl(context, Uri.parse(attempt.url)) ``` -------------------------------- ### Tag usage example Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/TagResource.md Shows creating a tag, attaching it to a document, and deleting it with force to detach from all uses first. ```kotlin val tag = client.tags.create("Contracts", color = "ff8800") client.documents.addTags(docId, listOf(tag.id)) client.tags.delete(tag.id, force = true) // detaches from all uses first ``` -------------------------------- ### Configure OAuth client with AssinafyClientConfig Source: https://github.com/assinafy/mobile-android-sdk/blob/main/README.en.md Creates an AssinafyClient with OAuth configuration for a public client. Requires a clientId and redirectUri; clientSecret must be null or a ValidationException is thrown. Scopes are requested as a list; the user approves all or nothing. ```kotlin val client = AssinafyClient.create( AssinafyClientConfig( baseUrl = SdkConstants.DEFAULT_BASE_URL, oauth = OAuthConfig( clientId = "your-client-id", redirectUri = "https://myapp.example/oauth/callback", scopes = listOf( OAuthScope.DOCUMENTS_READ, OAuthScope.DOCUMENTS_WRITE, OAuthScope.OFFLINE_ACCESS, ), ), ), ) ``` -------------------------------- ### GET /v1/webhooks/event-types Source: https://github.com/assinafy/mobile-android-sdk/blob/main/docs/API_REFERENCE.md Lists the available webhook event types. ```APIDOC ## [GET] /v1/webhooks/event-types ### Description Lists the available webhook event types. ### Method GET ### Endpoint /v1/webhooks/event-types ### Response #### Success Response (200) - **data** (List) - List of event type information. ``` -------------------------------- ### Create AssinafyClient with full configuration Source: https://github.com/assinafy/mobile-android-sdk/blob/main/README.en.md Creates an AssinafyClient using AssinafyClientConfig to expose the full configuration surface. Note that apiKey and token are mutually exclusive, and webhookSecret is only for verifying deliveries and is never sent. ```kotlin val client = AssinafyClient.create( AssinafyClientConfig( apiKey = apiKey, // sent as X-Api-Key token = null, // or a bearer token; the two are mutually exclusive accountId = accountId, // default account for account-scoped calls baseUrl = "https://api.assinafy.com.br/v1", webhookSecret = null, // endpoint whsec_ secret, only to verify deliveries; never sent timeoutMs = 30_000L, // connect, read, and write logger = null, // Logger.NONE by default; secrets are never logged oauth = null, // registered OAuth application; see OAuth 2.1 ), ) ``` -------------------------------- ### create Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/WorkspaceResource.md Creates a new workspace (account). Requires a request with a non-blank name and optional notification sender type and legacy colors. ```APIDOC ## POST /v1/accounts ### Description Creates a new workspace (account). The request must include a non-blank name; optional fields include notificationSenderType and legacy primaryColor/secondaryColor. ### Method POST ### Endpoint /v1/accounts ### Parameters #### Request Body - **request** (CreateWorkspaceRequest) - Required - Contains `name` (required, trimmed), optional `notificationSenderType` (`User`/`Account`), legacy `primaryColor`/`secondaryColor` (exactly six hex chars, no `#`). ### Request Example { "name": "Acme Inc.", "notification_sender_type": "Account" } ### Response #### Success Response (200) - **Workspace** - The created workspace object. #### Response Example { "id": "ws_123", "name": "Acme Inc." } ### Error Handling - **ValidationException** - Thrown for blank name, unsupported sender type, or invalid color. ``` -------------------------------- ### GET /v1/accounts Source: https://github.com/assinafy/mobile-android-sdk/blob/main/docs/API_COVERAGE.md Lists all accounts. Requires Account authentication. ```APIDOC ## GET /v1/accounts ### Description Lists all accounts. ### Method GET ### Endpoint /v1/accounts ### Authentication Account (X-Api-Key or Authorization: Bearer) ### SDK Method workspaces.list() ### Response #### Success Response (200) - **accounts** (array) - List of accounts. #### Response Example { "accounts": [] } ``` -------------------------------- ### Build and test with Docker Compose Source: https://github.com/assinafy/mobile-android-sdk/blob/main/README.en.md Commands to build the Docker image and run SDK unit tests or a full module build (compile, test, lint, package) in a container. ```shell docker compose build --pull docker compose run --rm test # SDK unit tests docker compose run --rm build # full module build: compile, test, lint, package ``` -------------------------------- ### GET /webhooks/event-types Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/endpoints.md Lists all available webhook event types. ```APIDOC ## GET /webhooks/event-types ### Description Lists all available webhook event types. ### Method GET ### Endpoint /webhooks/event-types ### Authentication Key/Bearer ### Response #### Success Response (200) - **data** (WebhookEventTypeInfo[]) - Array of event type information. #### Response Example { "data": [ { "type": "document.signed", "description": "Document signed" } ] } ``` -------------------------------- ### GET /documents/statuses Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/endpoints.md Retrieves the list of possible document statuses. ```APIDOC ## GET /documents/statuses ### Description Retrieves the list of possible document statuses. ### Method GET ### Endpoint /documents/statuses ### Response #### Success Response (200) - **data** (DocumentStatusInfo[]) - List of status information. #### Response Example { "data": [ { "status": "uploaded", "label": "Uploaded" } ] } ``` -------------------------------- ### create method signature Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/WorkspaceResource.md Creates a workspace via POST /v1/accounts. Throws ValidationException for blank name, unsupported sender type, or invalid color. ```kotlin suspend fun create(request: CreateWorkspaceRequest): Workspace ``` -------------------------------- ### Publish SDK to Maven Local Source: https://github.com/assinafy/mobile-android-sdk/blob/main/README.en.md Command to publish the SDK to Maven Local with a custom version. Use this when building against a checkout. ```shell ./gradlew :sdk:publishReleasePublicationToMavenLocal \ -Pversion=2.7.1-local-SNAPSHOT \ --no-daemon ``` -------------------------------- ### confirmData - suspend fun signature and usage example Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/SignerDocumentResource.md Confirms or corrects identity before signing. Only official fields (full_name, email, government_id) are sent; deprecated compatibility fields are ignored. Returns the updated signer record. The usage example shows constructing a ConfirmSignerDataRequest with fullName and email. ```kotlin suspend fun confirmData( documentId: String, signerAccessCode: String, request: ConfirmSignerDataRequest, ): Signer ``` ```kotlin client.signerDocuments.confirmData( documentId = docId, signerAccessCode = accessCode, request = ConfirmSignerDataRequest(fullName = "João Silva", email = "joao@example.com"), ) ``` -------------------------------- ### AssinafyClient.create(apiKey, accountId, baseUrl, webhookSecret, timeoutMs, logger) Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/AssinafyClient.md Creates an AssinafyClient with individual configuration parameters. Validates inputs and throws ValidationException for invalid configuration. ```APIDOC ## AssinafyClient.create(apiKey, accountId, baseUrl, webhookSecret, timeoutMs, logger) ### Description Creates a configured AssinafyClient using individual parameters. The API key is sent as `X-Api-Key` only to the configured API origin. Blank values for apiKey or accountId throw ValidationException. ### Method Factory method (Kotlin companion object) ### Signature ```kotlin fun create( apiKey: String, accountId: String, baseUrl: String = SdkConstants.DEFAULT_BASE_URL, webhookSecret: String? = null, timeoutMs: Long = SdkConstants.DEFAULT_TIMEOUT_MS, logger: Logger? = null, ): AssinafyClient ``` ### Parameters - **apiKey** (String) - Required - API key sent as `X-Api-Key` only to the configured API origin. Blank values throw. - **accountId** (String) - Required - Default account used by account-scoped resource methods. Blank values throw. - **baseUrl** (String) - Optional, default `https://api.assinafy.com.br/v1` - Full API prefix including `/v1` on Assinafy hosts. Trailing slash accepted; user info, query, fragment rejected. - **webhookSecret** (String?) - Optional, default `null` - `whsec_...` endpoint secret, used only by `webhookVerifier`; never sent to the API. - **timeoutMs** (Long) - Optional, default `30_000` - Positive per-request connect/read/write timeout in milliseconds. - **logger** (Logger?) - Optional, default `null` - Logging sink; `null` selects `Logger.NONE`. Secrets and payload bodies are never logged. ### Returns A configured `AssinafyClient` exposing all SDK resources. ### Throws `ValidationException` when the API key or account ID is blank, both credential types are set, the URL is invalid/insecure for credentials, or the timeout is not positive. ### Example ```kotlin val client = AssinafyClient.create( apiKey = "ass_api_key", accountId = "acc_123", ) ``` ### Error Example ```kotlin try { AssinafyClient.create(apiKey = "", accountId = "acc") } catch (e: ValidationException) { // "API key is required" } ``` ``` -------------------------------- ### GET /v1/users/self Source: https://github.com/assinafy/mobile-android-sdk/blob/main/docs/API_REFERENCE.md Retrieves the current user's profile information. ```APIDOC ## GET /v1/users/self ### Description Retrieves the current user's profile information. ### Method GET ### Endpoint /v1/users/self ### Parameters None. ### Request Body None. ### Response #### Success Response (200) - **id** (string) - User ID. - **name** (string) - User name. - **email** (string) - User email. - **telephone** (string|null) - Telephone number. - **government_id** (string|null) - Government ID. - **is_email_verified** (boolean) - Whether email is verified. - **has_accepted_terms** (boolean) - Whether terms are accepted. - **created_at** (string) - Creation timestamp. - **to_be_deleted_at** (string|null) - Deletion timestamp. #### Response Example { "id": "id-placeholder", "name": "Example", "email": "person@example.com", "telephone": null, "government_id": null, "is_email_verified": true, "has_accepted_terms": true, "created_at": "2026-01-01T00:00:00Z", "to_be_deleted_at": null } ``` -------------------------------- ### GET /v1/signers/identity-verification Source: https://github.com/assinafy/mobile-android-sdk/blob/main/docs/API_REFERENCE.md Retrieves the signer's identity verification status. ```APIDOC ## GET /v1/signers/identity-verification ### Description Retrieves the signer's identity verification status. ### Method GET ### Endpoint /v1/signers/identity-verification ### Parameters #### Query Parameters - **signer-access-code** (string) - Required - The access code for the signer. ### Response #### Success Response (200) - **SignerIdentityVerification** - The identity verification details. ``` -------------------------------- ### get Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/TemplateResource.md Retrieves a complete template including every page and its placed fields, plus roles, tags, and default document tags. This compatibility endpoint exists on deployed Assinafy environments even though the current public OpenAPI document exposes only the list route. ```APIDOC ## GET /v1/accounts/{accountId}/templates/{templateId} ### Description Retrieves a complete template including every page and its placed fields, plus roles, tags, and default document tags. This compatibility endpoint exists on deployed Assinafy environments even though the current public OpenAPI document exposes only the list route. ### Method GET ### Endpoint /v1/accounts/{accountId}/templates/{templateId} ### Parameters #### Path Parameters - **accountId** (string) - Required - The account ID. - **templateId** (string) - Required - The template ID. ### Response #### Success Response (200) - **Template** - Complete template including every page and its placed fields (`pages[].fields[]` with `field_id`, `role_id`, `label`, `display_settings`), plus `roles`, `tags`, and `default_document_tags`. #### Response Example ```json { "id": "template-id", "pages": [ { "fields": [ { "field_id": "field-id", "role_id": "role-id", "label": "Signature", "display_settings": {} } ] } ], "roles": [ { "id": "role-id", "name": "Signer" } ], "tags": [], "default_document_tags": [] } ``` ``` -------------------------------- ### GET /v1/accounts/{accountId} Source: https://github.com/assinafy/mobile-android-sdk/blob/main/docs/API_REFERENCE.md Retrieves a specific workspace by its account ID. ```APIDOC ## GET /v1/accounts/{accountId} ### Description Retrieves a specific workspace by its account ID. ### Method GET ### Endpoint /v1/accounts/{accountId} ### Parameters #### Path Parameters - **accountId** (string) - Required - The unique identifier of the workspace. ### Response #### Success Response (200) - **data** (Workspace) - The requested workspace. #### Response Example { "data": {} } ``` -------------------------------- ### Create endpoint and verify with WebhookVerifier Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/WebhookResource.md Example showing how to create an endpoint with signingEnabled = true, capture the one-time secret, and instantiate a WebhookVerifier with it. The secret must be stored server-side; it is not retrievable later by OAuth applications. ```kotlin val endpoint = client.webhooks.createEndpoint( CreateWebhookEndpointRequest( url = "https://myapp.example/webhooks/assinafy", email = "ops@example.com", events = listOf(WebhookEvent.DOCUMENT_READY, WebhookEvent.SIGNER_SIGNED_DOCUMENT), signingEnabled = true, ), ) val secret = endpoint.secret // one-time; store server-side val verifier = WebhookVerifier(secret) ``` -------------------------------- ### GET /v1/users/api-keys Source: https://github.com/assinafy/mobile-android-sdk/blob/main/docs/API_COVERAGE.md Retrieves the authenticated user's API keys. ```APIDOC ## GET /v1/users/api-keys ### Description Retrieves the authenticated user's API keys. ### Method GET ### Endpoint /v1/users/api-keys ### Authentication Account ### SDK Method authentication.getApiKey() ``` -------------------------------- ### GET /signers/identity-verification Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/endpoints.md Retrieves the signer's identity verification status. ```APIDOC ## GET /signers/identity-verification ### Description Retrieves the signer's identity verification status. ### Method GET ### Endpoint /signers/identity-verification ### Response #### Success Response (200) - **data** (SignerIdentityVerification) - The identity verification object. #### Response Example { "data": { "status": "pending" } } ``` -------------------------------- ### GET /signature/{type} Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/endpoints.md Downloads a signature image of the specified type. ```APIDOC ## GET /signature/{type} ### Description Downloads a signature image of the specified type. ### Method GET ### Endpoint /signature/{type} ### Parameters #### Path Parameters - **type** (string) - Required - The type of signature. ### Response #### Success Response (200) - **data** (binary) - The signature image. #### Response Example (binary image data) ``` -------------------------------- ### GET /documents/{documentId}/activities Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/endpoints.md Retrieves the activity log for a document. ```APIDOC ## GET /documents/{documentId}/activities ### Description Retrieves the activity log for a document. ### Method GET ### Endpoint /documents/{documentId}/activities ### Parameters #### Path Parameters - **documentId** (string) - Required - The document identifier. ### Response #### Success Response (200) - **data** (DocumentActivity[]) - List of activities. #### Response Example { "data": [ { "type": "created", "timestamp": "2023-01-01T00:00:00Z" } ] } ``` -------------------------------- ### Full local verification command Source: https://github.com/assinafy/mobile-android-sdk/blob/main/docs/TESTING.md Runs the complete local verification suite: assemble release, unit tests, lint, ktlint, Dokka HTML generation, publish to Maven Local, and consumer smoke assemble. Use with --no-daemon and --stacktrace. ```shell ./gradlew \ :sdk:assembleRelease \ :sdk:test \ :sdk:lintDebug \ :sdk:ktlintCheck \ :sdk:dokkaGeneratePublicationHtml \ :sdk:publishReleasePublicationToMavenLocal \ :consumer-smoke:assembleRelease \ --no-daemon \ --stacktrace ``` -------------------------------- ### GET /documents/{documentId}/thumbnail Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/endpoints.md Retrieves a thumbnail image of the document. ```APIDOC ## GET /documents/{documentId}/thumbnail ### Description Retrieves a thumbnail image of the document. ### Method GET ### Endpoint /documents/{documentId}/thumbnail ### Parameters #### Path Parameters - **documentId** (string) - Required - The document identifier. ### Response #### Success Response (200) - Binary image. #### Response Example (binary content) ``` -------------------------------- ### POST /v1/users/self/mfa/totp Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/AuthenticationResource.md Starts the enrollment of a new TOTP authenticator device. Returns a secret and provisioning URI to set up the authenticator app. Two-factor authentication remains disabled until the enrollment is confirmed. ```APIDOC ## [POST] /v1/users/self/mfa/totp ### Description Starts the enrollment of a new TOTP authenticator device. Returns a secret and provisioning URI to set up the authenticator app. Two-factor authentication remains disabled until the enrollment is confirmed. ### Method POST ### Endpoint /v1/users/self/mfa/totp ### Authentication Authenticated ### Parameters #### Request Body - **label** (String?) - Optional - Optional name that tells devices apart. ### Request Example { "label": "My Phone" } ### Response #### Success Response (200) - **id** (string) - Identifier of the pending enrollment. - **secret** (string) - Secret shown only once. - **provisioningUri** (string) - URI to build a QR code. #### Response Example { "id": "pending_enrollment_id", "secret": "JBSWY3DPEHPK3PXP", "provisioningUri": "otpauth://totp/Example:user?secret=JBSWY3DPEHPK3PXP&issuer=Example" } ``` -------------------------------- ### GET /documents/{documentId} Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/endpoints.md Retrieves full details of a specific document. ```APIDOC ## GET /documents/{documentId} ### Description Retrieves full details of a specific document. ### Method GET ### Endpoint /documents/{documentId} ### Parameters #### Path Parameters - **documentId** (string) - Required - The document identifier. ### Response #### Success Response (200) - **data** (DocumentDetails) - Full document details. #### Response Example { "data": { "id": "doc_123", "status": "uploaded" } } ``` -------------------------------- ### Run Gradle build and tests locally Source: https://github.com/assinafy/mobile-android-sdk/blob/main/README.en.md Runs the full SDK build, tests, lint, Ktlint, Dokka documentation, publication to Maven local, and consumer smoke build. Requires the local toolchain (JDK 25 and Android SDK). ```shell ./gradlew \ :sdk:assembleRelease \ :sdk:test \ :sdk:lintDebug \ :sdk:ktlintCheck \ :sdk:dokkaGeneratePublicationHtml \ :sdk:publishReleasePublicationToMavenLocal \ :consumer-smoke:assembleRelease \ --no-daemon ``` -------------------------------- ### GET /users/self/mfa Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/endpoints.md Lists the MFA methods configured for the authenticated user. ```APIDOC ## GET /users/self/mfa ### Description Lists the MFA methods configured for the authenticated user. ### Method GET ### Endpoint /users/self/mfa ### Authentication Key or Bearer ### Parameters None ### Response #### Success Response (200) - **data** (MfaStatus) - MFA status and methods #### Response Example { "status": "success", "message": "MFA methods retrieved", "data": { "methods": [] } } ``` -------------------------------- ### GET /users/api-keys Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/endpoints.md Retrieves the current API key for the authenticated user. ```APIDOC ## GET /users/api-keys ### Description Retrieves the current API key for the authenticated user. ### Method GET ### Endpoint /users/api-keys ### Authentication Key or Bearer ### Parameters None ### Response #### Success Response (200) - **data** (object or null) - Contains `api_key` or null #### Response Example { "status": "success", "message": "API key retrieved", "data": { "api_key": "..." } } ``` -------------------------------- ### Factory method signatures for create() Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/AssinafyClient.md Declares the two public create() overloads: one with individual parameters and one accepting an AssinafyClientConfig. The parameterized version includes defaults for baseUrl, webhookSecret, timeoutMs, and logger. ```kotlin fun create( apiKey: String, accountId: String, baseUrl: String = SdkConstants.DEFAULT_BASE_URL, webhookSecret: String? = null, timeoutMs: Long = SdkConstants.DEFAULT_TIMEOUT_MS, logger: Logger? = null, ): AssinafyClient fun create(config: AssinafyClientConfig): AssinafyClient ``` -------------------------------- ### Create AssinafyClient with common settings Source: https://github.com/assinafy/mobile-android-sdk/blob/main/README.en.md Function that creates an AssinafyClient using the default base URL. The client validates the configuration and should be reused for the process lifetime. ```kotlin fun accountClient(apiKey: String, accountId: String): AssinafyClient = AssinafyClient.create( apiKey = apiKey, accountId = accountId, baseUrl = SdkConstants.DEFAULT_BASE_URL, // https://api.assinafy.com.br/v1 ) ``` -------------------------------- ### get method signature Source: https://github.com/assinafy/mobile-android-sdk/blob/main/_autodocs/api-reference/FieldResource.md Retrieves a single field definition by its ID. ```kotlin suspend fun get(fieldId: String, accountId: String? = null): FieldDefinition ``` -------------------------------- ### POST /v1/signers/identity-verification Source: https://github.com/assinafy/mobile-android-sdk/blob/main/docs/API_REFERENCE.md Starts identity verification for the signer after explicit consent. ```APIDOC ## POST /v1/signers/identity-verification ### Description Starts identity verification for the signer after explicit consent. ### Method POST ### Endpoint /v1/signers/identity-verification ### Parameters #### Query Parameters - **signer-access-code** (string) - Required - The access code for the signer. #### Request Body - **consent** (boolean) - Required - Must be true to indicate explicit signer consent. ### Request Example { "consent": true } ### Response #### Success Response (200) - **IdentityVerificationSession** - The identity verification session details. ```