Add OTP email update endpoint to OpenAPI#450
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
✱ Stainless preview buildsThis PR will update the kotlin openapi python typescript Edit this comment to update them. They will appear in their respective SDK's changelogs. ✅ grid-python studio · code · diff
✅ grid-kotlin studio · code · diff
✅ grid-typescript studio · code · diff
✅ grid-openapi studio · code · diff
This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push. |
Greptile SummaryThis PR documents a new
Confidence Score: 5/5Safe 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.
|
| 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
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
e4c91f7 to
c2ec444
Compare
b53b7c9 to
1070357
Compare
c2ec444 to
24bdfeb
Compare
✱ Stainless preview builds for gridThis PR will update the kotlin openapi python typescript
|
1070357 to
b800a3e
Compare
24bdfeb to
679c965
Compare
679c965 to
5825ec7
Compare
b800a3e to
2ecd602
Compare
2ecd602 to
d12632b
Compare
5825ec7 to
75d2847
Compare
pengying
left a comment
There was a problem hiding this comment.
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?
|
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 |
75d2847 to
e1c65a5
Compare
d12632b to
c04d214
Compare
|
If you guys wanna support patch, make it a PATCH on the /auth/credential/{id} |
c04d214 to
bade835
Compare
e1c65a5 to
4adb176
Compare
4adb176 to
aadbb4a
Compare
bade835 to
91ede9f
Compare
91ede9f to
9360c43
Compare
aadbb4a to
4808147
Compare
4808147 to
ee39422
Compare
|
updated it to PATCH on the /auth/credential/{id} |

Summary:
PATCH /internal-accounts/{id}/emailtoPATCH /auth/credentials/{id}, matching auth credential ownership.AuthSignedRequestChallengewithpayloadToSign,requestId,expiresAt, and credentialtype; signed retries return200with the updatedAuthMethod.AuthCredentialUpdateRequestas a partial credential patch body. Today it supportsemailforEMAIL_OTPcredentials only.EMAIL_OTP_EMAIL_ALREADY_EXISTSonError409for duplicate EMAIL_OTP email addresses.openapi.yamlplusmintlify/openapi.yaml.Files added:
openapi/components/schemas/auth/AuthCredentialUpdateRequest.yamlFiles updated:
.stainless/stainless.ymlopenapi/paths/auth/auth_credentials_{id}.yamlopenapi/components/schemas/auth/AuthSignedRequestChallenge.yamlopenapi/components/schemas/errors/Error409.yamlFiles removed:
openapi/paths/internal_accounts/internal_accounts_{id}_email.yamlopenapi/components/schemas/internal_accounts/InternalAccountEmailUpdateRequest.yamlopenapi/components/schemas/internal_accounts/InternalAccountEmailUpdateResponse.yamlTesting:
npm run lint:openapigit diff --check