Skip to content

Add OTP email update endpoint to OpenAPI#450

Merged
DhruvPareek merged 2 commits into
mainfrom
auth-email-otp-update-openapi
May 11, 2026
Merged

Add OTP email update endpoint to OpenAPI#450
DhruvPareek merged 2 commits into
mainfrom
auth-email-otp-update-openapi

Conversation

@DhruvPareek
Copy link
Copy Markdown
Contributor

@DhruvPareek DhruvPareek commented May 8, 2026

Summary:

  • Moves the email OTP update OpenAPI path from PATCH /internal-accounts/{id}/email to PATCH /auth/credentials/{id}, matching auth credential ownership.
  • Models credential update as the existing two-step signed-retry flow: initial calls return AuthSignedRequestChallenge with payloadToSign, requestId, expiresAt, and credential type; signed retries return 200 with the updated AuthMethod.
  • Adds AuthCredentialUpdateRequest as a partial credential patch body. Today it supports email for EMAIL_OTP credentials only.
  • Keeps EMAIL_OTP_EMAIL_ALREADY_EXISTS on Error409 for duplicate EMAIL_OTP email addresses.
  • Wires the new auth credential update operation into Stainless and regenerates openapi.yaml plus mintlify/openapi.yaml.

Files added:

  • openapi/components/schemas/auth/AuthCredentialUpdateRequest.yaml

Files updated:

  • .stainless/stainless.yml
  • openapi/paths/auth/auth_credentials_{id}.yaml
  • openapi/components/schemas/auth/AuthSignedRequestChallenge.yaml
  • openapi/components/schemas/errors/Error409.yaml

Files removed:

  • openapi/paths/internal_accounts/internal_accounts_{id}_email.yaml
  • openapi/components/schemas/internal_accounts/InternalAccountEmailUpdateRequest.yaml
  • openapi/components/schemas/internal_accounts/InternalAccountEmailUpdateResponse.yaml

Testing:

  • npm run lint:openapi
  • git diff --check

@vercel
Copy link
Copy Markdown

vercel Bot commented May 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
grid-flow-builder Ready Ready Preview, Comment May 11, 2026 10:56pm

Request Review

@DhruvPareek DhruvPareek changed the title Add internal account email update endpoint Add OTP email update endpoint to OpenAPI May 8, 2026
@DhruvPareek DhruvPareek marked this pull request as draft May 8, 2026 00:10
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

✱ Stainless preview builds

This PR will update the grid SDKs with the following commit messages.

kotlin

feat(api): add updateEmail method to customers

openapi

feat(api): add update_email method to internal_accounts

python

feat(api): add update_email method to customers

typescript

feat(api): add updateEmail method to customers

Edit this comment to update them. They will appear in their respective SDK's changelogs.

grid-python studio · code · diff

Your SDK build had at least one "note" diagnostic, but this did not represent a regression.
generate ✅build ✅ (prev: build ⏭️) → lint ✅ (prev: lint ⏭️) → test ✅

pip install https://pkg.stainless.com/s/grid-python/4bfed75ad98876bac6b058feb230a884c3e6b7f6/grid-0.0.1-py3-none-any.whl
grid-kotlin studio · code · diff

Your SDK build had at least one "note" diagnostic, but this did not represent a regression.
generate ✅build ✅ (prev: build ⏭️) → lint ✅ (prev: lint ⏭️) → test ✅

grid-typescript studio · code · diff

Your SDK build had at least one "note" diagnostic, but this did not represent a regression.
generate ✅build ❗lint ❗test ❗

grid-openapi studio · code · diff

Your SDK build had at least one "note" diagnostic, but this did not represent a regression.
generate ✅


This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push.
If you push custom code to the preview branch, re-run this workflow to update the comment.
Last updated: 2026-05-08 00:28:29 UTC

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 8, 2026

Greptile Summary

This PR documents a new PATCH /internal-accounts/{id}/email endpoint for updating the EMAIL_OTP credential email on an Embedded Wallet account, following the existing two-step signed-retry pattern established by the export endpoint.

  • Adds the path definition, InternalAccountEmailUpdateRequest and InternalAccountEmailUpdateResponse schemas, and wires them into the root spec and both generated bundles.
  • Extends Error409 with the EMAIL_OTP_EMAIL_ALREADY_EXISTS error code and documents the 409 conflict response on the new endpoint.

Confidence Score: 5/5

Safe to merge — this is a documentation-only change that correctly mirrors the established signed-retry flow pattern with no logic or runtime code affected.

The new endpoint definition closely tracks the sibling export endpoint, all required response codes (including the previously requested 409) are present, the schema fields are correctly typed, and the bundled outputs match the source. The only finding is a cosmetic response-ordering inconsistency in the source YAML that the bundler already corrects in generated output.

No files require special attention.

Important Files Changed

Filename Overview
openapi/paths/internal_accounts/internal_accounts_{id}_email.yaml New PATCH endpoint for updating EMAIL_OTP email via the two-step signed-retry flow; closely mirrors the export endpoint pattern with correct responses (200, 202, 400, 401, 409, 404, 500), though 409 and 404 are listed out of ascending order in the source file.
openapi/components/schemas/internal_accounts/InternalAccountEmailUpdateRequest.yaml New request schema with required email field (format: email), detailed description, and correct structure.
openapi/components/schemas/internal_accounts/InternalAccountEmailUpdateResponse.yaml New response schema with required id, email, and updatedAt fields; missing top-level description (noted in previous thread).
openapi/components/schemas/errors/Error409.yaml Adds EMAIL_OTP_EMAIL_ALREADY_EXISTS to the Error409 error code enum and description table.
openapi/openapi.yaml Wires /internal-accounts/{id}/email path ref into the root spec alongside the existing export path.
openapi.yaml Auto-generated bundle; correctly includes the new endpoint inline with all schema definitions.
mintlify/openapi.yaml Auto-generated Mintlify bundle; identical new content to openapi.yaml; bundler correctly reorders 404 before 409 in the output.

Sequence Diagram

sequenceDiagram
    participant C as Client
    participant G as Grid API

    C->>G: "PATCH /internal-accounts/{id}/email<br/>Body: { email }"
    G-->>C: "202 Accepted<br/>{ payloadToSign, requestId, expiresAt }"

    Note over C: Sign payloadToSign with session API keypair

    C->>G: "PATCH /internal-accounts/{id}/email<br/>Grid-Wallet-Signature: stamp<br/>Request-Id: requestId<br/>Body: { email }"
    alt Email available
        G-->>C: "200 OK { id, email, updatedAt }"
    else Email already in use
        G-->>C: 409 Conflict EMAIL_OTP_EMAIL_ALREADY_EXISTS
    else Signature or challenge mismatch
        G-->>C: 401 Unauthorized
    end
Loading

Fix All in Claude Code

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
openapi/paths/internal_accounts/internal_accounts_{id}_email.yaml:103-118
The `409` response block is placed before `404`, breaking the ascending HTTP status-code order that every other endpoint in this repo follows (including the sibling export endpoint). OpenAPI parsers are order-agnostic so this is harmless at runtime, but the bundled output already reorders them correctly, which signals the mismatch with the source.

```suggestion
    '404':
      description: Internal account not found
      content:
        application/json:
          schema:
            $ref: ../../components/schemas/errors/Error404.yaml
    '409':
      description: >-
        Conflict. Returned when the supplied email address is already
        associated with an `EMAIL_OTP` credential on this or another
        internal account.
      content:
        application/json:
          schema:
            $ref: ../../components/schemas/errors/Error409.yaml
    '500':
```

Reviews (2): Last reviewed commit: "Add internal account email update endpoi..." | Re-trigger Greptile

Comment thread openapi/paths/internal_accounts/internal_accounts_{id}_email.yaml Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

✱ Stainless preview builds for grid

This PR will update the grid SDKs with the following commit messages.

kotlin

feat(api): add updateEmail method to customers

openapi

feat(api): add update_email method to internal_accounts

python

feat(api): add update_email method to customers

typescript

feat(api): add updateEmail method to customers
⚠️ grid-python studio · code

Your SDK build had at least one "error" diagnostic.
generate ❗build ✅lint ✅test ✅

pip install https://pkg.stainless.com/s/grid-python/d709f5d7a6fbabca90ecf77412e88c1ba930a9a3/grid-0.0.1-py3-none-any.whl
⚠️ grid-kotlin studio · code

Your SDK build had at least one "error" diagnostic.
generate ❗build ✅lint ✅test ✅

⚠️ grid-openapi studio · code

Your SDK build had at least one "error" diagnostic.
generate ❗

⚠️ grid-typescript studio · code

Your SDK build had a failure in the build CI job, which is a regression from the base state.
generate ❗build ❗lint ❗test ❗


This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push.
If you push custom code to the preview branch, re-run this workflow to update the comment.
Last updated: 2026-05-11 23:13:30 UTC

@DhruvPareek DhruvPareek force-pushed the auth-passkey-challenge-credential-id-openapi branch from 1070357 to b800a3e Compare May 8, 2026 23:06
@DhruvPareek DhruvPareek force-pushed the auth-email-otp-update-openapi branch from 24bdfeb to 679c965 Compare May 8, 2026 23:06
@DhruvPareek DhruvPareek force-pushed the auth-email-otp-update-openapi branch from 679c965 to 5825ec7 Compare May 11, 2026 17:25
@DhruvPareek DhruvPareek force-pushed the auth-passkey-challenge-credential-id-openapi branch from b800a3e to 2ecd602 Compare May 11, 2026 17:25
@DhruvPareek DhruvPareek force-pushed the auth-passkey-challenge-credential-id-openapi branch from 2ecd602 to d12632b Compare May 11, 2026 20:36
@DhruvPareek DhruvPareek force-pushed the auth-email-otp-update-openapi branch from 5825ec7 to 75d2847 Compare May 11, 2026 20:36
Copy link
Copy Markdown
Contributor

@pengying pengying left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we weren't going to do the /internal_account/{id}/credential patch?

Also I thought the flow would be to add a second email otp address then delete the first one? Do we need a patch?

Copy link
Copy Markdown
Contributor Author

DhruvPareek commented May 11, 2026

PPatch is realy easy to impplement because the delete endpoint just calls turnkey and modifies the email field to "". We can pretty easily add this patch endpoint and just modify the email address directly instead of requiring two calls

@DhruvPareek DhruvPareek requested a review from pengying May 11, 2026 21:20
@DhruvPareek DhruvPareek force-pushed the auth-email-otp-update-openapi branch from 75d2847 to e1c65a5 Compare May 11, 2026 21:28
@DhruvPareek DhruvPareek force-pushed the auth-passkey-challenge-credential-id-openapi branch from d12632b to c04d214 Compare May 11, 2026 21:28
Copy link
Copy Markdown
Contributor

If you guys wanna support patch, make it a PATCH on the /auth/credential/{id}

@DhruvPareek DhruvPareek force-pushed the auth-passkey-challenge-credential-id-openapi branch from c04d214 to bade835 Compare May 11, 2026 22:13
@DhruvPareek DhruvPareek force-pushed the auth-email-otp-update-openapi branch from e1c65a5 to 4adb176 Compare May 11, 2026 22:13
@DhruvPareek DhruvPareek force-pushed the auth-email-otp-update-openapi branch from 4adb176 to aadbb4a Compare May 11, 2026 22:14
@DhruvPareek DhruvPareek force-pushed the auth-passkey-challenge-credential-id-openapi branch from bade835 to 91ede9f Compare May 11, 2026 22:14
@DhruvPareek DhruvPareek changed the base branch from auth-passkey-challenge-credential-id-openapi to graphite-base/450 May 11, 2026 22:38
@DhruvPareek DhruvPareek force-pushed the auth-email-otp-update-openapi branch from aadbb4a to 4808147 Compare May 11, 2026 22:38
@graphite-app graphite-app Bot changed the base branch from graphite-base/450 to main May 11, 2026 22:39
Copy link
Copy Markdown
Contributor Author

updated it to PATCH on the /auth/credential/{id}

@DhruvPareek DhruvPareek merged commit f29ff4e into main May 11, 2026
9 of 10 checks passed
@DhruvPareek DhruvPareek deleted the auth-email-otp-update-openapi branch May 11, 2026 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants