{
  "openapi": "3.1.0",
  "info": {
    "title": "Gully ID",
    "version": "0.1.0",
    "summary": "Sign in with Gully ID, the profile an app receives, and public lookups of connected social accounts.",
    "description": "Gully ID is a standard OpenID Connect provider: one passkey account for every Gully app, open to any app. This document covers what an outside app or a signed-out visitor may call. Gully ID never holds a private key and never gives an app a way to move funds.\n\n## Sign in with Gully ID\n\nAuthorization code with PKCE (S256).\n\n1. Make an app at https://gullyid.xyz/developers/console and save your redirect addresses. An app that runs in a browser or on a phone has no secret.\n2. Easiest in a browser: load the SDK and place the button. Latest 1.x: `https://gullyid.xyz/sdk/v1.js`. Pinned: `https://gullyid.xyz/sdk/v{version}.js` (for example `https://gullyid.xyz/sdk/v1.7.2.js`) with the `integrity` hash from `https://gullyid.xyz/sdk/manifest.json` and `crossorigin=\"anonymous\"`. Guide: https://gullyid.xyz/developers/sign-in-with-gully.\n3. Or use any OpenID Connect library: read `https://gullyid.xyz/.well-known/openid-configuration`, send the browser to the authorize endpoint, exchange the code at the token endpoint.\n4. Check the id token (RS256): `iss` is `https://gullyid.xyz/` with the trailing slash, `aud` holds your app id, `exp`, and your `nonce`.\n5. On your server call `GET /v1/profile?client_id=<your app id>` with the access token and store `sub` as the user id.\n\nAccess tokens last 1 hour; refresh tokens last 30 days and are replaced on use. The person sees a consent screen that lists every scope you ask for.\n\n| Scope | What the app gets |\n|---|---|\n| `openid` | Always needed. Gives `sub` (the stable user id) and `amr` (how the person signed in). |\n| `profile` | Display name and picture. |\n| `email` | A confirmed email address, or null when there is none. |\n| `wallet` | The public address of the person's wallet. An address cannot move funds. |\n| `gully_name` | The person's primary .gully name, or null. |\n| `reputation` | Read-only reputation facts from Gully Chain. |\n| `offline_access` | A refresh token, so the app can renew access without asking again. |\n\n## Connections\n\nA person can connect social accounts to their Gully ID by proving each one. Apps read the result without a key: by wallet address, in batches, or by handle (\"handle verified\"). To let a person connect a network, send them to `https://gullyid.xyz/connect/{network}?address={their wallet}`. Gully ID signs them in, checks that the address is theirs and runs the proof. Gully sites may add `return={https page}` and get the person back with `connected={network}` or `connect_error={code}`; from any other site the person ends on their Gully ID connections page.\n\n| Network | id | How the handle is proven |\n|---|---|---|\n| Telegram | `telegram` | Signed sign-in from the network, checked by Gully ID |\n| Farcaster | `farcaster` | A message signed with the account, checked by Gully ID |\n| Discord | `discord` | The person signs in at the network; Gully ID reads the account id and keeps no token |\n| Instagram | `instagram` | A one-time code placed in the public profile |\n| YouTube | `youtube` | The person signs in at the network; Gully ID reads the account id and keeps no token |\n| X | `x` | The person signs in at the network; Gully ID reads the account id and keeps no token |\n| TikTok | `tiktok` | The person signs in at the network; Gully ID reads the account id and keeps no token |\n| GitHub | `github` | The person signs in at the network; Gully ID reads the account id and keeps no token |\n\nEach connection carries a receipt signed with Ed25519. The signed text is six lines joined by a line break: `Gully ID connection v1`, `address: <lower case address>`, `provider: <id>`, `id: <account id on the network>`, `handle: <handle>`, `verified: <ISO time>`. A receipt shows what was proven at that time; the live answer is the lookup by address.\n\n## Limits\n\nLimits are counted per visitor (or per account where noted) in fixed windows. Over the limit the answer is HTTP 429 with code `rate_limited` and the header `Retry-After`. No other limit headers are sent.\n\n| Call | Limit |\n|---|---|\n| `/v1/wallet/chip` | 60 calls per minute per account |\n| `/v1/connections/by-address/{address}` | 240 calls per minute per visitor |\n| `/v1/connections/batch` | 120 calls per minute per visitor |\n| `/v1/connections/handle` | 120 calls per minute per visitor |\n\n## Errors\n\nThe Gully ID API answers errors as `{ \"code\", \"message\" }` with a stable `code`. The sign-in endpoints (`/oauth2/*`, `/userinfo`) answer in the OAuth shape `{ \"error\", \"error_description\" }`.\n\n| Code | HTTP | Meaning |\n|---|---|---|\n| bad_request | 400 | The request could not be read. |\n| invalid_request | 400 | A parameter is missing or malformed. The message says which. |\n| invalid_address | 400 | The address is not a 0x address. |\n| unknown_provider | 400 | The network name is not one Gully ID knows. Read the list from /v1/connections/providers. |\n| unauthorized | 401 | No token was sent, or it is expired or revoked. |\n| audience_mismatch | 401 | The token was issued to another app than the one named in client_id. |\n| first_party_only | 403 | The token belongs to an outside app. Use /v1/profile, which returns what the person agreed to share. |\n| no_wallet | 404 | This Gully ID has no wallet yet. |\n| not_found | 404 | Unknown path. |\n| rate_limited | 429 | Too many requests. Wait for the number of seconds in Retry-After. |\n| internal | 500 | Something went wrong on our side. |\n| wallet_unavailable | 503 | The wallet balance could not be read right now. Retry shortly. |",
    "x-generated-by": "scripts/gen-openapi.mjs"
  },
  "servers": [
    {
      "url": "https://gullyid.xyz",
      "description": "Gully ID"
    }
  ],
  "tags": [
    {
      "name": "Sign in",
      "description": "OpenID Connect: discovery, keys, authorize, token, user info, sign-out."
    },
    {
      "name": "Profile",
      "description": "The signed-in person, as your app may see them."
    },
    {
      "name": "Connections",
      "description": "Public lookups of proven social accounts."
    },
    {
      "name": "Wallet chip",
      "description": "The shared wallet total in Gully headers."
    },
    {
      "name": "SDK",
      "description": "Versions and integrity hashes of the browser SDK."
    },
    {
      "name": "Configuration",
      "description": "What this Gully ID offers."
    }
  ],
  "paths": {
    "/.well-known/openid-configuration": {
      "get": {
        "operationId": "getOpenIdConfiguration",
        "tags": [
          "Sign in"
        ],
        "summary": "OpenID Connect discovery document",
        "description": "Where every sign-in endpoint lives. Read the endpoints from here instead of typing them into your app. Call it from your server or at build time: browsers on other sites are not allowed to read it.",
        "security": [],
        "responses": {
          "200": {
            "description": "The discovery document.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenIdConfiguration"
                },
                "example": {
                  "issuer": "https://gullyid.xyz/",
                  "authorization_endpoint": "https://gullyid.xyz/oauth2/auth",
                  "token_endpoint": "https://gullyid.xyz/oauth2/token",
                  "userinfo_endpoint": "https://gullyid.xyz/userinfo",
                  "jwks_uri": "https://gullyid.xyz/.well-known/jwks.json",
                  "revocation_endpoint": "https://gullyid.xyz/oauth2/revoke",
                  "end_session_endpoint": "https://gullyid.xyz/oauth2/sessions/logout",
                  "scopes_supported": [
                    "openid",
                    "profile",
                    "email",
                    "wallet",
                    "gully_name",
                    "reputation",
                    "offline_access"
                  ],
                  "claims_supported": [
                    "sub",
                    "amr",
                    "name",
                    "picture",
                    "email",
                    "email_verified",
                    "wallet",
                    "gully_name",
                    "reputation"
                  ],
                  "response_types_supported": [
                    "code"
                  ],
                  "grant_types_supported": [
                    "authorization_code",
                    "refresh_token"
                  ],
                  "subject_types_supported": [
                    "public"
                  ],
                  "id_token_signing_alg_values_supported": [
                    "RS256"
                  ],
                  "code_challenge_methods_supported": [
                    "S256"
                  ],
                  "token_endpoint_auth_methods_supported": [
                    "none",
                    "client_secret_basic"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/.well-known/jwks.json": {
      "get": {
        "operationId": "getJwks",
        "tags": [
          "Sign in"
        ],
        "summary": "Public keys that sign id tokens",
        "description": "Check the signature of an id token (RS256) with these keys. Pick the key whose `kid` matches the token header. Keys rotate, so read them again when a `kid` is unknown.",
        "security": [],
        "responses": {
          "200": {
            "description": "The key set.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Jwks"
                },
                "example": {
                  "keys": [
                    {
                      "kty": "RSA",
                      "use": "sig",
                      "alg": "RS256",
                      "kid": "EXAMPLE_KEY_ID",
                      "n": "EXAMPLE_MODULUS",
                      "e": "AQAB"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/oauth2/auth": {
      "get": {
        "operationId": "authorize",
        "tags": [
          "Sign in"
        ],
        "summary": "Start a sign-in (send the browser here)",
        "description": "Open this address in a popup or as a full-page redirect. The person signs in on Gully ID and the browser comes back to your `redirect_uri` with `code` and `state`. The code lasts 10 minutes and works once. Apps without a secret must use PKCE with S256. This is a page, not a JSON call.",
        "security": [],
        "parameters": [
          {
            "name": "response_type",
            "in": "query",
            "required": true,
            "description": "Always `code`.",
            "schema": {
              "type": "string",
              "enum": [
                "code"
              ]
            },
            "example": "code"
          },
          {
            "name": "client_id",
            "in": "query",
            "required": true,
            "description": "The id of your app from the developer console.",
            "schema": {
              "type": "string"
            },
            "example": "app_xxxxxxxxxxxxxxxxxxxx"
          },
          {
            "name": "redirect_uri",
            "in": "query",
            "required": true,
            "description": "One of the redirect addresses saved for your app. Exact match.",
            "schema": {
              "type": "string",
              "format": "uri"
            },
            "example": "https://yourapp.example/gully-id/callback.html"
          },
          {
            "name": "scope",
            "in": "query",
            "required": true,
            "description": "Space separated. One or more of: openid, profile, email, wallet, gully_name, reputation, offline_access.",
            "schema": {
              "type": "string"
            },
            "example": "openid profile wallet"
          },
          {
            "name": "state",
            "in": "query",
            "required": true,
            "description": "A random value you check when the browser comes back.",
            "schema": {
              "type": "string",
              "minLength": 8
            },
            "example": "RANDOM_STATE"
          },
          {
            "name": "nonce",
            "in": "query",
            "required": false,
            "description": "A random value that comes back inside the id token.",
            "schema": {
              "type": "string"
            },
            "example": "RANDOM_NONCE"
          },
          {
            "name": "code_challenge",
            "in": "query",
            "required": false,
            "description": "base64url(sha256(code_verifier)). Needed for apps without a secret.",
            "schema": {
              "type": "string"
            },
            "example": "BASE64URL_SHA256_OF_VERIFIER"
          },
          {
            "name": "code_challenge_method",
            "in": "query",
            "required": false,
            "description": "Always `S256`.",
            "schema": {
              "type": "string",
              "enum": [
                "S256"
              ]
            },
            "example": "S256"
          },
          {
            "name": "screen_hint",
            "in": "query",
            "required": false,
            "description": "`signup` opens the page on \"Create my Gully ID\".",
            "schema": {
              "type": "string",
              "enum": [
                "signup"
              ]
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect to the Gully ID sign-in page, and in the end to your `redirect_uri` with `code` and `state`, or with `error` and `error_description`."
          }
        }
      }
    },
    "/oauth2/token": {
      "post": {
        "operationId": "exchangeToken",
        "tags": [
          "Sign in"
        ],
        "summary": "Exchange a code, or refresh",
        "description": "Turns the code into tokens. The access token is an opaque string that lasts 1 hour; the id token is a signed JWT that lasts 1 hour; a refresh token (scope `offline_access`) lasts 30 days and is replaced on every use. An app without a secret sends `client_id` in the body; a server app with a secret uses HTTP Basic. From a browser this works only on the origins saved for your app.",
        "security": [
          {},
          {
            "clientBasic": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/TokenRequest"
              },
              "examples": {
                "code": {
                  "summary": "Exchange a code (app without a secret)",
                  "value": {
                    "grant_type": "authorization_code",
                    "code": "CODE_FROM_REDIRECT",
                    "redirect_uri": "https://yourapp.example/gully-id/callback.html",
                    "client_id": "app_xxxxxxxxxxxxxxxxxxxx",
                    "code_verifier": "YOUR_CODE_VERIFIER"
                  }
                },
                "refresh": {
                  "summary": "Refresh",
                  "value": {
                    "grant_type": "refresh_token",
                    "refresh_token": "YOUR_REFRESH_TOKEN",
                    "client_id": "app_xxxxxxxxxxxxxxxxxxxx"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The tokens.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenResponse"
                },
                "example": {
                  "access_token": "ACCESS_TOKEN_PLACEHOLDER",
                  "token_type": "bearer",
                  "expires_in": 3600,
                  "scope": "openid profile wallet",
                  "id_token": "ID_TOKEN_PLACEHOLDER"
                }
              }
            }
          },
          "400": {
            "description": "The code is used, expired or belongs to another redirect address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                },
                "example": {
                  "error": "invalid_grant",
                  "error_description": "The authorization code is not valid."
                }
              }
            }
          },
          "401": {
            "description": "The app is unknown or its secret is wrong.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                },
                "example": {
                  "error": "invalid_client",
                  "error_description": "Client authentication failed."
                }
              }
            }
          }
        }
      }
    },
    "/userinfo": {
      "get": {
        "operationId": "getUserInfo",
        "tags": [
          "Sign in"
        ],
        "summary": "Claims of the signed-in person (standard endpoint)",
        "description": "The standard OpenID Connect answer, limited to the scopes the person agreed to. `/v1/profile` returns the same person with friendlier field names and tells you which app the token belongs to.",
        "security": [
          {
            "accessToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "The claims.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserInfo"
                },
                "example": {
                  "sub": "00000000-0000-4000-8000-000000000000",
                  "amr": [
                    "passkey"
                  ],
                  "name": "alice.gully",
                  "picture": null,
                  "wallet": {
                    "chainId": 485590,
                    "address": "0x1111111111111111111111111111111111111111",
                    "kind": "kernel-v3.3"
                  },
                  "gully_name": "alice.gully"
                }
              }
            }
          },
          "401": {
            "description": "The token is missing, expired or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                },
                "example": {
                  "error": "request_unauthorized",
                  "error_description": "The request could not be authorized."
                }
              }
            }
          }
        }
      }
    },
    "/oauth2/revoke": {
      "post": {
        "operationId": "revokeToken",
        "tags": [
          "Sign in"
        ],
        "summary": "Sign out: revoke a token",
        "description": "Ends an access or refresh token at once. Call it when the person signs out of your app, then clear your own session.",
        "security": [
          {},
          {
            "clientBasic": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "token"
                ],
                "properties": {
                  "token": {
                    "type": "string",
                    "description": "The access or refresh token."
                  },
                  "client_id": {
                    "type": "string",
                    "description": "Your app id, for apps without a secret."
                  }
                }
              },
              "example": {
                "token": "ACCESS_TOKEN_PLACEHOLDER",
                "client_id": "app_xxxxxxxxxxxxxxxxxxxx"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Done. The answer is the same when the token was already ended."
          },
          "401": {
            "description": "The app is unknown.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                },
                "example": {
                  "error": "invalid_client",
                  "error_description": "Client authentication failed."
                }
              }
            }
          }
        }
      }
    },
    "/oauth2/sessions/logout": {
      "get": {
        "operationId": "endSession",
        "tags": [
          "Sign in"
        ],
        "summary": "Sign out of Gully ID too (send the browser here)",
        "description": "For shared computers: ends the person's Gully ID session as well as yours. A page, not a JSON call.",
        "security": [],
        "parameters": [
          {
            "name": "id_token_hint",
            "in": "query",
            "required": true,
            "description": "The id token your app received.",
            "schema": {
              "type": "string"
            },
            "example": "ID_TOKEN_PLACEHOLDER"
          },
          {
            "name": "post_logout_redirect_uri",
            "in": "query",
            "required": false,
            "description": "Where to send the browser afterwards: an origin of your app with a trailing slash.",
            "schema": {
              "type": "string",
              "format": "uri"
            },
            "example": "https://yourapp.example/"
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "A random value that comes back on the redirect.",
            "schema": {
              "type": "string"
            },
            "example": "RANDOM_STATE"
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect to the Gully ID sign-out page, then to `post_logout_redirect_uri`."
          }
        }
      }
    },
    "/v1/profile": {
      "get": {
        "operationId": "getProfile",
        "tags": [
          "Profile"
        ],
        "summary": "The signed-in person, limited to what they agreed to share",
        "description": "Send the access token as a bearer token. **Always pass `client_id`** (or the `X-Gully-Client-Id` header) with your own app id: a token that was issued to any other app is then refused with 401 `audience_mismatch`, so a token from another app can never sign someone in to yours. Store `sub` as the user id; never the wallet or the email.\n\nAn outside app gets `sub`, `amr`, `client` and the fields of the scopes it was granted. From a browser, this call works on the origins saved for your app.",
        "security": [
          {
            "accessToken": []
          }
        ],
        "parameters": [
          {
            "name": "client_id",
            "in": "query",
            "required": false,
            "description": "Your app id. Up to 200 characters.",
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "example": "app_xxxxxxxxxxxxxxxxxxxx"
          },
          {
            "name": "X-Gully-Client-Id",
            "in": "header",
            "required": false,
            "description": "Your app id, as a header instead of the query parameter.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The profile.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Profile"
                },
                "example": {
                  "sub": "00000000-0000-4000-8000-000000000000",
                  "amr": [
                    "passkey"
                  ],
                  "client": "app_xxxxxxxxxxxxxxxxxxxx",
                  "name": "alice.gully",
                  "avatar": null,
                  "wallet": {
                    "chainId": 485590,
                    "address": "0x1111111111111111111111111111111111111111",
                    "kind": "kernel-v3.3"
                  },
                  "wallets": [
                    {
                      "chainId": 485590,
                      "address": "0x1111111111111111111111111111111111111111",
                      "kind": "kernel-v3.3"
                    }
                  ],
                  "gullyName": "alice.gully"
                }
              }
            }
          },
          "400": {
            "description": "`client_id` is too long.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_request": {
                    "value": {
                      "code": "invalid_request",
                      "message": "A parameter is missing or malformed. The message says which."
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "No valid token, or a token issued to another app.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "value": {
                      "code": "unauthorized",
                      "message": "No token was sent, or it is expired or revoked."
                    }
                  },
                  "audience_mismatch": {
                    "value": {
                      "code": "audience_mismatch",
                      "message": "The token was issued to another app than the one named in client_id."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/wallet/chip": {
      "get": {
        "operationId": "getWalletChip",
        "tags": [
          "Wallet chip"
        ],
        "summary": "Total of the person's Gully ID wallet in USD (Gully apps only)",
        "description": "What the shared wallet chip in Gully headers shows: one USD total, how many assets have no price, how many chains did not answer, and the address. No asset list. **Only a Gully ID session or the token of an app run by Gully Labs may read it.** A token of an outside app gets 403 `first_party_only`; outside apps show the wallet address from `/v1/profile` (scope `wallet`) instead. Listed here so the SDK chip is fully described. Limit: 60 calls per minute per account.",
        "security": [
          {
            "accessToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "The chip data.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WalletChip"
                },
                "example": {
                  "address": "0x1111111111111111111111111111111111111111",
                  "totalUsd": 12.34,
                  "unpriced": 0,
                  "unreadable": 0,
                  "updatedAt": "2026-01-01T00:00:00.000Z"
                }
              }
            }
          },
          "401": {
            "description": "No valid token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "value": {
                      "code": "unauthorized",
                      "message": "No token was sent, or it is expired or revoked."
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "The token belongs to an outside app.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "first_party_only": {
                    "value": {
                      "code": "first_party_only",
                      "message": "The token belongs to an outside app. Use /v1/profile, which returns what the person agreed to share."
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "This Gully ID has no wallet yet.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "no_wallet": {
                    "value": {
                      "code": "no_wallet",
                      "message": "This Gully ID has no wallet yet."
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next call. Sent with every 429.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "code": "rate_limited",
                  "message": "Too many requests. Wait for the number of seconds in Retry-After."
                }
              }
            }
          },
          "503": {
            "description": "Balances could not be read right now.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "wallet_unavailable": {
                    "value": {
                      "code": "wallet_unavailable",
                      "message": "The wallet balance could not be read right now. Retry shortly."
                    }
                  }
                }
              }
            }
          }
        },
        "x-rate-limit": [
          {
            "limit": 60,
            "windowSeconds": 60,
            "per": "account"
          }
        ]
      }
    },
    "/v1/connections/providers": {
      "get": {
        "operationId": "listConnectionProviders",
        "tags": [
          "Connections"
        ],
        "summary": "Networks a person can connect, and the public key that signs the receipts",
        "description": "Which social networks can be connected right now (`live`) and which are not switched on yet (`coming_soon`), plus the Ed25519 public key for checking connection receipts. No key needed; any web page may read it. Cached for 5 minutes.",
        "security": [],
        "responses": {
          "200": {
            "description": "Networks and the signing key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionProviders"
                },
                "example": {
                  "providers": [
                    {
                      "id": "telegram",
                      "label": "Telegram",
                      "flow": "telegram",
                      "state": "live"
                    },
                    {
                      "id": "farcaster",
                      "label": "Farcaster",
                      "flow": "farcaster",
                      "state": "live"
                    },
                    {
                      "id": "discord",
                      "label": "Discord",
                      "flow": "oauth",
                      "state": "coming_soon"
                    },
                    {
                      "id": "instagram",
                      "label": "Instagram",
                      "flow": "proof",
                      "state": "coming_soon"
                    },
                    {
                      "id": "youtube",
                      "label": "YouTube",
                      "flow": "oauth",
                      "state": "coming_soon"
                    },
                    {
                      "id": "x",
                      "label": "X",
                      "flow": "oauth",
                      "state": "coming_soon"
                    },
                    {
                      "id": "tiktok",
                      "label": "TikTok",
                      "flow": "oauth",
                      "state": "coming_soon"
                    },
                    {
                      "id": "github",
                      "label": "GitHub",
                      "flow": "oauth",
                      "state": "coming_soon"
                    }
                  ],
                  "attestation": {
                    "alg": "ed25519",
                    "keyId": "aaaaaaaaaaaaaaaa",
                    "publicKey": "BASE64URL_PUBLIC_KEY",
                    "version": 1
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/connections/by-address/{address}": {
      "get": {
        "operationId": "getConnectionsByAddress",
        "tags": [
          "Connections"
        ],
        "summary": "Connected accounts of a wallet address",
        "description": "Every network the owner of this address has proven, each with a signed receipt, and the trust level of the Gully ID. An address Gully ID does not know answers `unverified` with an empty list. Only live connections are listed; one the person disconnected is gone at once. No key needed; any web page may read it. Cached for 60 seconds. Limit: 240 calls per minute per visitor.",
        "security": [],
        "parameters": [
          {
            "name": "address",
            "in": "path",
            "required": true,
            "description": "A wallet address (0x + 40 hex), any letter case.",
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$"
            },
            "example": "0x1111111111111111111111111111111111111111"
          }
        ],
        "responses": {
          "200": {
            "description": "Trust level and connections.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddressConnections"
                },
                "example": {
                  "address": "0x1111111111111111111111111111111111111111",
                  "trustLevel": "verified",
                  "connections": [
                    {
                      "provider": "telegram",
                      "handle": "alice",
                      "providerUserId": "100000001",
                      "verifiedAt": "2026-01-01T00:00:00.000Z",
                      "lastCheckedAt": "2026-01-01T00:00:00.000Z",
                      "attestation": {
                        "v": 1,
                        "message": "Gully ID connection v1\naddress: 0x1111111111111111111111111111111111111111\nprovider: telegram\nid: 100000001\nhandle: alice\nverified: 2026-01-01T00:00:00.000Z",
                        "signature": "BASE64URL_SIGNATURE",
                        "keyId": "aaaaaaaaaaaaaaaa",
                        "record": "v1:alice:100000001:1767225600:BASE64URL_SIGNATURE"
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Not a 0x address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid_address": {
                    "value": {
                      "code": "invalid_address",
                      "message": "The address is not a 0x address."
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next call. Sent with every 429.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "code": "rate_limited",
                  "message": "Too many requests. Wait for the number of seconds in Retry-After."
                }
              }
            }
          }
        },
        "x-rate-limit": [
          {
            "limit": 240,
            "windowSeconds": 60,
            "per": "visitor"
          }
        ]
      }
    },
    "/v1/connections/batch": {
      "get": {
        "operationId": "getConnectionsBatch",
        "tags": [
          "Connections"
        ],
        "summary": "Connected accounts of up to 50 addresses",
        "description": "The short view for lists and cards: trust level, network, handle and date for each address, without receipts. Addresses beyond the first 50 and values that are not addresses are skipped without an error. Keys of `items` are lower case. No key needed; any web page may read it. Cached for 60 seconds. Limit: 120 calls per minute per visitor.",
        "security": [],
        "parameters": [
          {
            "name": "addresses",
            "in": "query",
            "required": true,
            "description": "Comma separated wallet addresses, up to 50.",
            "schema": {
              "type": "string"
            },
            "example": "0x1111111111111111111111111111111111111111,0x2222222222222222222222222222222222222222"
          }
        ],
        "responses": {
          "200": {
            "description": "One entry per address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchConnections"
                },
                "example": {
                  "items": {
                    "0x1111111111111111111111111111111111111111": {
                      "trustLevel": "verified",
                      "connections": [
                        {
                          "provider": "telegram",
                          "handle": "alice",
                          "verifiedAt": "2026-01-01T00:00:00.000Z"
                        }
                      ]
                    },
                    "0x2222222222222222222222222222222222222222": {
                      "trustLevel": "unverified",
                      "connections": []
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next call. Sent with every 429.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "code": "rate_limited",
                  "message": "Too many requests. Wait for the number of seconds in Retry-After."
                }
              }
            }
          }
        },
        "x-rate-limit": [
          {
            "limit": 120,
            "windowSeconds": 60,
            "per": "visitor"
          }
        ]
      }
    },
    "/v1/connections/handle": {
      "get": {
        "operationId": "getConnectionByHandle",
        "tags": [
          "Connections"
        ],
        "summary": "Has someone proven this handle?",
        "description": "Use it when a person types a handle into your app: if the handle is already proven by a Gully ID, you get that wallet address and can refuse a copy. A handle that is malformed or not proven answers `verified: false`. A leading @ or a full profile link is accepted. No key needed; any web page may read it. Cached for 60 seconds. Limit: 120 calls per minute per visitor.",
        "security": [],
        "parameters": [
          {
            "name": "provider",
            "in": "query",
            "required": true,
            "description": "The network id.",
            "schema": {
              "type": "string",
              "enum": [
                "telegram",
                "farcaster",
                "discord",
                "instagram",
                "youtube",
                "x",
                "tiktok",
                "github"
              ]
            },
            "example": "telegram"
          },
          {
            "name": "handle",
            "in": "query",
            "required": true,
            "description": "The handle on that network.",
            "schema": {
              "type": "string"
            },
            "example": "alice"
          }
        ],
        "responses": {
          "200": {
            "description": "Whether the handle is proven, and by which address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HandleOwner"
                },
                "examples": {
                  "proven": {
                    "summary": "Handle verified",
                    "value": {
                      "verified": true,
                      "address": "0x1111111111111111111111111111111111111111"
                    }
                  },
                  "free": {
                    "summary": "Not proven by anyone",
                    "value": {
                      "verified": false,
                      "address": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Unknown network.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unknown_provider": {
                    "value": {
                      "code": "unknown_provider",
                      "message": "The network name is not one Gully ID knows. Read the list from /v1/connections/providers."
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next call. Sent with every 429.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "code": "rate_limited",
                  "message": "Too many requests. Wait for the number of seconds in Retry-After."
                }
              }
            }
          }
        },
        "x-rate-limit": [
          {
            "limit": 120,
            "windowSeconds": 60,
            "per": "visitor"
          }
        ]
      }
    },
    "/.well-known/gully-id-attestation.json": {
      "get": {
        "operationId": "getAttestationKey",
        "tags": [
          "Connections"
        ],
        "summary": "Public key that signs connection receipts",
        "description": "The same key as in `/v1/connections/providers`, with a note on how to check a signature. No key needed; any web page may read it. Cached for 1 hour.",
        "security": [],
        "responses": {
          "200": {
            "description": "The key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AttestationKey"
                },
                "example": {
                  "alg": "ed25519",
                  "keyId": "aaaaaaaaaaaaaaaa",
                  "publicKey": "BASE64URL_PUBLIC_KEY",
                  "version": 1,
                  "message": "Gully ID connection v1",
                  "verify": "Ed25519 over the UTF-8 message, signature and public key are base64url"
                }
              }
            }
          }
        }
      }
    },
    "/.well-known/gully-id.json": {
      "get": {
        "operationId": "getGullyIdConfig",
        "tags": [
          "Configuration"
        ],
        "summary": "What this Gully ID offers",
        "description": "Which sign-in methods are on, the issuer, the passkey settings, the chain the wallets live on and where the SDK is. Read it at build time or from your server instead of hard-coding any of it: browsers on other sites are not allowed to read it.",
        "security": [],
        "responses": {
          "200": {
            "description": "The configuration.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GullyIdConfig"
                },
                "example": {
                  "issuer": "https://gullyid.xyz/",
                  "api": "https://gullyid.xyz",
                  "methods": {
                    "passkey": true,
                    "wallet": true,
                    "email": true,
                    "google": false,
                    "x": false,
                    "apple": false
                  },
                  "socialProviders": [],
                  "sdk": "https://gullyid.xyz/sdk.js",
                  "sdkCurrent": {
                    "version": "1.7.2",
                    "url": "https://gullyid.xyz/sdk/v1.js",
                    "pinned": "https://gullyid.xyz/sdk/v1.7.2.js",
                    "manifest": "https://gullyid.xyz/sdk/manifest.json",
                    "element": "gully-id-button"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/sdk/manifest.json": {
      "get": {
        "operationId": "getSdkManifest",
        "tags": [
          "SDK"
        ],
        "summary": "SDK versions, addresses and integrity hashes",
        "description": "Every SDK version that is served, with its address and its `integrity` hash for a pinned `<script>` tag. Take the hash from here at build time; do not copy it by hand. Versions served now: 1.7.2, 1.7.1, 1.6.2, 1.5.0, 1.4.0, 1.3.0. No key needed; any web page may read it. Cached for 5 minutes.",
        "security": [],
        "responses": {
          "200": {
            "description": "The manifest.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SdkManifest"
                },
                "example": {
                  "latest": "1.7.2",
                  "majors": {
                    "1": {
                      "version": "1.7.2",
                      "url": "https://gullyid.xyz/sdk/v1.js"
                    }
                  },
                  "versions": {
                    "1.7.2": {
                      "url": "https://gullyid.xyz/sdk/v1.7.2.js",
                      "integrity": "sha384-EXAMPLE_HASH"
                    },
                    "1.7.1": {
                      "url": "https://gullyid.xyz/sdk/v1.7.1.js",
                      "integrity": "sha384-EXAMPLE_HASH"
                    }
                  },
                  "relay": true,
                  "element": "gully-id-button",
                  "chipElement": "gully-id-chip",
                  "signInElement": "gully-id-signin",
                  "docs": "https://gullyid.xyz/developers/sign-in-with-gully"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "openId": {
        "type": "openIdConnect",
        "openIdConnectUrl": "https://gullyid.xyz/.well-known/openid-configuration",
        "description": "Sign in with Gully ID."
      },
      "accessToken": {
        "type": "http",
        "scheme": "bearer",
        "description": "The access token your app received from the token endpoint."
      },
      "clientBasic": {
        "type": "http",
        "scheme": "basic",
        "description": "Server apps with a secret: app id and secret. Never in a browser or a phone app."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "bad_request",
              "invalid_request",
              "invalid_address",
              "unknown_provider",
              "unauthorized",
              "audience_mismatch",
              "first_party_only",
              "no_wallet",
              "not_found",
              "rate_limited",
              "internal",
              "wallet_unavailable"
            ]
          },
          "message": {
            "type": "string",
            "description": "The reason, in plain words."
          }
        }
      },
      "OAuthError": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "examples": [
              "invalid_grant"
            ]
          },
          "error_description": {
            "type": "string"
          }
        }
      },
      "OpenIdConfiguration": {
        "type": "object",
        "required": [
          "issuer",
          "authorization_endpoint",
          "token_endpoint",
          "jwks_uri"
        ],
        "properties": {
          "issuer": {
            "type": "string",
            "const": "https://gullyid.xyz/"
          },
          "authorization_endpoint": {
            "type": "string",
            "format": "uri"
          },
          "token_endpoint": {
            "type": "string",
            "format": "uri"
          },
          "userinfo_endpoint": {
            "type": "string",
            "format": "uri"
          },
          "jwks_uri": {
            "type": "string",
            "format": "uri"
          },
          "revocation_endpoint": {
            "type": "string",
            "format": "uri"
          },
          "end_session_endpoint": {
            "type": "string",
            "format": "uri"
          },
          "scopes_supported": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "openid",
                "profile",
                "email",
                "wallet",
                "gully_name",
                "reputation",
                "offline_access"
              ]
            }
          },
          "claims_supported": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "sub",
                "amr",
                "name",
                "picture",
                "email",
                "email_verified",
                "wallet",
                "gully_name",
                "reputation"
              ]
            }
          },
          "response_types_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "grant_types_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "subject_types_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "id_token_signing_alg_values_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "code_challenge_methods_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "token_endpoint_auth_methods_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": true
      },
      "Jwks": {
        "type": "object",
        "required": [
          "keys"
        ],
        "properties": {
          "keys": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kty": {
                  "type": "string"
                },
                "use": {
                  "type": "string"
                },
                "alg": {
                  "type": "string"
                },
                "kid": {
                  "type": "string"
                },
                "n": {
                  "type": "string"
                },
                "e": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "TokenRequest": {
        "type": "object",
        "required": [
          "grant_type"
        ],
        "properties": {
          "grant_type": {
            "type": "string",
            "enum": [
              "authorization_code",
              "refresh_token"
            ]
          },
          "code": {
            "type": "string",
            "description": "With authorization_code: the code from the redirect."
          },
          "redirect_uri": {
            "type": "string",
            "format": "uri",
            "description": "With authorization_code: the same address as in the authorize step."
          },
          "code_verifier": {
            "type": "string",
            "description": "With authorization_code: the PKCE verifier."
          },
          "refresh_token": {
            "type": "string",
            "description": "With refresh_token."
          },
          "client_id": {
            "type": "string",
            "description": "Your app id, for apps without a secret."
          }
        }
      },
      "TokenResponse": {
        "type": "object",
        "required": [
          "access_token",
          "token_type",
          "expires_in"
        ],
        "properties": {
          "access_token": {
            "type": "string"
          },
          "token_type": {
            "type": "string",
            "const": "bearer"
          },
          "expires_in": {
            "type": "integer",
            "description": "Seconds."
          },
          "scope": {
            "type": "string"
          },
          "id_token": {
            "type": "string",
            "description": "Signed JWT. Check it before trusting it."
          },
          "refresh_token": {
            "type": "string",
            "description": "Only with scope offline_access."
          }
        }
      },
      "Wallet": {
        "type": "object",
        "required": [
          "address",
          "kind"
        ],
        "properties": {
          "chainId": {
            "type": [
              "integer",
              "null"
            ],
            "examples": [
              485590
            ]
          },
          "address": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{40}$"
          },
          "kind": {
            "type": "string",
            "enum": [
              "kernel-v3.3",
              "eoa"
            ],
            "description": "kernel-v3.3 = passkey smart account; eoa = a linked browser wallet."
          }
        }
      },
      "Reputation": {
        "type": "object",
        "properties": {
          "available": {
            "type": "boolean",
            "description": "false when the chain could not be read; the other fields are then empty."
          },
          "verified": {
            "type": "boolean"
          },
          "hasGullyName": {
            "type": "boolean"
          },
          "accountAgeBlocks": {
            "type": "integer"
          },
          "quests": {
            "type": "object",
            "properties": {
              "completed": {
                "type": "integer"
              },
              "ids": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              }
            }
          },
          "xp": {
            "type": "integer"
          },
          "badges": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "UserInfo": {
        "type": "object",
        "required": [
          "sub"
        ],
        "properties": {
          "sub": {
            "type": "string",
            "format": "uuid",
            "description": "Stable user id, the same for every app."
          },
          "amr": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "How the person signed in, for example passkey, siwe, email."
          },
          "name": {
            "type": "string",
            "description": "Scope profile."
          },
          "picture": {
            "type": [
              "string",
              "null"
            ],
            "description": "Scope profile."
          },
          "email": {
            "type": [
              "string",
              "null"
            ],
            "description": "Scope email."
          },
          "email_verified": {
            "type": "boolean",
            "description": "Scope email."
          },
          "wallet": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Wallet"
              },
              {
                "type": "null"
              }
            ],
            "description": "Scope wallet."
          },
          "gully_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Scope gully_name."
          },
          "reputation": {
            "$ref": "#/components/schemas/Reputation",
            "description": "Scope reputation."
          }
        }
      },
      "Profile": {
        "type": "object",
        "required": [
          "sub",
          "amr",
          "client"
        ],
        "properties": {
          "sub": {
            "type": "string",
            "format": "uuid",
            "description": "Stable user id, the same for every app. Store this."
          },
          "amr": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "How the person signed in, for example passkey, siwe, email."
          },
          "client": {
            "type": [
              "string",
              "null"
            ],
            "description": "The app the token was issued to. Must be your app id. null for a direct Gully ID session."
          },
          "name": {
            "type": "string",
            "description": "Scope profile. The .gully name, else a display name, else a short address."
          },
          "avatar": {
            "type": [
              "string",
              "null"
            ],
            "description": "Scope profile. An https picture address."
          },
          "badges": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "verified",
                "business"
              ]
            },
            "description": "Scope profile. Badges approved after review; left out when there are none."
          },
          "email": {
            "type": [
              "string",
              "null"
            ],
            "description": "Scope email. A confirmed address, or null."
          },
          "wallet": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Wallet"
              },
              {
                "type": "null"
              }
            ],
            "description": "Scope wallet. The main wallet."
          },
          "wallets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Wallet"
            },
            "description": "Scope wallet. Every wallet of the person."
          },
          "gullyName": {
            "type": [
              "string",
              "null"
            ],
            "description": "Scope gully_name."
          },
          "verified": {
            "type": "boolean",
            "description": "Scope reputation. Literal field name: the person holds the reviewed creator badge."
          },
          "reputation": {
            "$ref": "#/components/schemas/Reputation",
            "description": "Scope reputation."
          },
          "methods": {
            "type": "object",
            "description": "Gully apps only: which sign-in methods the person has.",
            "additionalProperties": {
              "type": "boolean"
            }
          }
        }
      },
      "WalletChip": {
        "type": "object",
        "required": [
          "address",
          "totalUsd",
          "unpriced",
          "unreadable",
          "updatedAt"
        ],
        "properties": {
          "address": {
            "type": "string",
            "description": "The wallet address."
          },
          "totalUsd": {
            "type": [
              "number",
              "null"
            ],
            "description": "Total in USD, two decimals. null when nothing could be priced."
          },
          "unpriced": {
            "type": "integer",
            "description": "Assets with no price."
          },
          "unreadable": {
            "type": "integer",
            "description": "Chains that did not answer."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ConnectionProvider": {
        "type": "object",
        "required": [
          "id",
          "label",
          "flow",
          "state"
        ],
        "properties": {
          "id": {
            "type": "string",
            "enum": [
              "telegram",
              "farcaster",
              "discord",
              "instagram",
              "youtube",
              "x",
              "tiktok",
              "github"
            ]
          },
          "label": {
            "type": "string"
          },
          "flow": {
            "type": "string",
            "enum": [
              "telegram",
              "farcaster",
              "oauth",
              "proof"
            ]
          },
          "state": {
            "type": "string",
            "enum": [
              "live",
              "coming_soon"
            ],
            "description": "live = people can connect it now."
          }
        }
      },
      "AttestationKey": {
        "type": "object",
        "required": [
          "alg",
          "keyId",
          "publicKey",
          "version"
        ],
        "properties": {
          "alg": {
            "type": "string",
            "const": "ed25519"
          },
          "keyId": {
            "type": "string",
            "description": "Short id of the key."
          },
          "publicKey": {
            "type": "string",
            "description": "The raw 32-byte public key, base64url."
          },
          "version": {
            "type": "integer",
            "const": 1
          },
          "message": {
            "type": "string",
            "description": "First line of every signed text."
          },
          "verify": {
            "type": "string"
          }
        }
      },
      "ConnectionProviders": {
        "type": "object",
        "required": [
          "providers",
          "attestation"
        ],
        "properties": {
          "providers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConnectionProvider"
            }
          },
          "attestation": {
            "$ref": "#/components/schemas/AttestationKey"
          }
        }
      },
      "TrustLevel": {
        "type": "string",
        "enum": [
          "unverified",
          "verified",
          "business"
        ],
        "description": "`unverified` = no live connection; `verified` = at least one live connection; `business` = the approved business badge."
      },
      "Connection": {
        "type": "object",
        "required": [
          "provider",
          "handle",
          "providerUserId",
          "verifiedAt",
          "lastCheckedAt",
          "attestation"
        ],
        "properties": {
          "provider": {
            "type": "string",
            "enum": [
              "telegram",
              "farcaster",
              "discord",
              "instagram",
              "youtube",
              "x",
              "tiktok",
              "github"
            ]
          },
          "handle": {
            "type": "string"
          },
          "providerUserId": {
            "type": "string",
            "description": "The account id on that network. It stays the same when the handle changes."
          },
          "verifiedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the handle was proven."
          },
          "lastCheckedAt": {
            "type": "string",
            "format": "date-time"
          },
          "attestation": {
            "type": "object",
            "required": [
              "v",
              "message",
              "signature",
              "keyId",
              "record"
            ],
            "properties": {
              "v": {
                "type": "integer",
                "const": 1
              },
              "message": {
                "type": "string",
                "description": "The signed text."
              },
              "signature": {
                "type": "string",
                "description": "Ed25519 signature, base64url."
              },
              "keyId": {
                "type": "string"
              },
              "record": {
                "type": "string",
                "description": "Compact form: v1:<handle>:<id>:<unix time>:<signature>. Read the signature from the right."
              }
            }
          }
        }
      },
      "AddressConnections": {
        "type": "object",
        "required": [
          "address",
          "trustLevel",
          "connections"
        ],
        "properties": {
          "address": {
            "type": "string"
          },
          "trustLevel": {
            "$ref": "#/components/schemas/TrustLevel"
          },
          "connections": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Connection"
            }
          }
        }
      },
      "BatchConnections": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "object",
            "description": "Keyed by lower case address.",
            "additionalProperties": {
              "type": "object",
              "required": [
                "trustLevel",
                "connections"
              ],
              "properties": {
                "trustLevel": {
                  "$ref": "#/components/schemas/TrustLevel"
                },
                "connections": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "provider",
                      "handle",
                      "verifiedAt"
                    ],
                    "properties": {
                      "provider": {
                        "type": "string"
                      },
                      "handle": {
                        "type": "string"
                      },
                      "verifiedAt": {
                        "type": "string",
                        "format": "date-time"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "HandleOwner": {
        "type": "object",
        "required": [
          "verified",
          "address"
        ],
        "properties": {
          "verified": {
            "type": "boolean",
            "description": "true when a Gully ID has proven this handle."
          },
          "address": {
            "type": [
              "string",
              "null"
            ],
            "description": "Wallet address of that Gully ID, or null."
          }
        }
      },
      "GullyIdConfig": {
        "type": "object",
        "properties": {
          "issuer": {
            "type": [
              "string",
              "null"
            ],
            "description": "The OpenID Connect issuer, with the trailing slash."
          },
          "api": {
            "type": "string",
            "format": "uri"
          },
          "webauthn": {
            "type": "object",
            "description": "Passkey settings.",
            "properties": {
              "rpId": {
                "type": "string"
              },
              "rpName": {
                "type": "string"
              },
              "acceptedRpIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "chain": {
            "type": "object",
            "description": "The chain the wallets live on.",
            "properties": {
              "id": {
                "type": "integer"
              },
              "rpcUrl": {
                "type": "string",
                "format": "uri"
              },
              "rpcUrls": {
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          },
          "accounts": {
            "type": "object",
            "description": "Wallet kind and the public contract addresses it uses.",
            "additionalProperties": true
          },
          "recovery": {
            "type": "object",
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "delayHours": {
                "type": "number"
              },
              "emailMinAgeHours": {
                "type": "number"
              }
            }
          },
          "socialProviders": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Social sign-in methods that are on."
          },
          "methods": {
            "type": "object",
            "description": "Sign-in methods, on or off.",
            "properties": {
              "passkey": {
                "type": "boolean"
              },
              "wallet": {
                "type": "boolean"
              },
              "email": {
                "type": "boolean"
              },
              "google": {
                "type": "boolean"
              },
              "x": {
                "type": "boolean"
              },
              "apple": {
                "type": "boolean"
              }
            }
          },
          "siwe": {
            "type": "object",
            "properties": {
              "chainIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              }
            }
          },
          "walletConnectProjectId": {
            "type": [
              "string",
              "null"
            ]
          },
          "relatedOrigins": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sdk": {
            "type": "string",
            "format": "uri"
          },
          "sdkCurrent": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string"
              },
              "url": {
                "type": "string",
                "format": "uri"
              },
              "pinned": {
                "type": "string",
                "format": "uri"
              },
              "manifest": {
                "type": "string",
                "format": "uri"
              },
              "element": {
                "type": "string"
              }
            }
          }
        }
      },
      "SdkManifest": {
        "type": "object",
        "required": [
          "latest",
          "versions"
        ],
        "properties": {
          "latest": {
            "type": "string",
            "examples": [
              "1.7.2"
            ]
          },
          "majors": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "properties": {
                "version": {
                  "type": "string"
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          },
          "versions": {
            "type": "object",
            "description": "Keyed by version.",
            "additionalProperties": {
              "type": "object",
              "required": [
                "url",
                "integrity"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "format": "uri"
                },
                "integrity": {
                  "type": "string",
                  "description": "Value for the integrity attribute."
                },
                "deprecated": {
                  "type": "boolean"
                }
              }
            }
          },
          "relay": {
            "type": "boolean",
            "description": "true while the old popup return page still works. New apps set a callback page on their own origin."
          },
          "callback": {
            "type": "string"
          },
          "element": {
            "type": "string"
          },
          "chipElement": {
            "type": "string"
          },
          "signInElement": {
            "type": "string"
          },
          "docs": {
            "type": "string",
            "format": "uri"
          }
        }
      }
    }
  },
  "x-scopes": [
    {
      "scope": "openid",
      "meaning": "Always needed. Gives `sub` (the stable user id) and `amr` (how the person signed in)."
    },
    {
      "scope": "profile",
      "meaning": "Display name and picture."
    },
    {
      "scope": "email",
      "meaning": "A confirmed email address, or null when there is none."
    },
    {
      "scope": "wallet",
      "meaning": "The public address of the person's wallet. An address cannot move funds."
    },
    {
      "scope": "gully_name",
      "meaning": "The person's primary .gully name, or null."
    },
    {
      "scope": "reputation",
      "meaning": "Read-only reputation facts from Gully Chain."
    },
    {
      "scope": "offline_access",
      "meaning": "A refresh token, so the app can renew access without asking again."
    }
  ],
  "x-sdk": {
    "latest": "1.7.2",
    "url": "https://gullyid.xyz/sdk/v1.js",
    "pinnedPattern": "https://gullyid.xyz/sdk/v{version}.js",
    "manifest": "https://gullyid.xyz/sdk/manifest.json",
    "versions": [
      "1.7.2",
      "1.7.1",
      "1.6.2",
      "1.5.0",
      "1.4.0",
      "1.3.0"
    ]
  },
  "x-rate-limit": {
    "headers": [
      "Retry-After"
    ],
    "note": "Only Retry-After is sent, with a 429. There are no remaining-calls headers, so space your calls by the limits below.",
    "limits": [
      {
        "operationId": "getWalletChip",
        "path": "/v1/wallet/chip",
        "limits": [
          {
            "limit": 60,
            "windowSeconds": 60,
            "per": "account"
          }
        ]
      },
      {
        "operationId": "getConnectionsByAddress",
        "path": "/v1/connections/by-address/{address}",
        "limits": [
          {
            "limit": 240,
            "windowSeconds": 60,
            "per": "visitor"
          }
        ]
      },
      {
        "operationId": "getConnectionsBatch",
        "path": "/v1/connections/batch",
        "limits": [
          {
            "limit": 120,
            "windowSeconds": 60,
            "per": "visitor"
          }
        ]
      },
      {
        "operationId": "getConnectionByHandle",
        "path": "/v1/connections/handle",
        "limits": [
          {
            "limit": 120,
            "windowSeconds": 60,
            "per": "visitor"
          }
        ]
      }
    ]
  },
  "x-errors": [
    {
      "code": "bad_request",
      "http": 400,
      "meaning": "The request could not be read."
    },
    {
      "code": "invalid_request",
      "http": 400,
      "meaning": "A parameter is missing or malformed. The message says which."
    },
    {
      "code": "invalid_address",
      "http": 400,
      "meaning": "The address is not a 0x address."
    },
    {
      "code": "unknown_provider",
      "http": 400,
      "meaning": "The network name is not one Gully ID knows. Read the list from /v1/connections/providers."
    },
    {
      "code": "unauthorized",
      "http": 401,
      "meaning": "No token was sent, or it is expired or revoked."
    },
    {
      "code": "audience_mismatch",
      "http": 401,
      "meaning": "The token was issued to another app than the one named in client_id."
    },
    {
      "code": "first_party_only",
      "http": 403,
      "meaning": "The token belongs to an outside app. Use /v1/profile, which returns what the person agreed to share."
    },
    {
      "code": "no_wallet",
      "http": 404,
      "meaning": "This Gully ID has no wallet yet."
    },
    {
      "code": "not_found",
      "http": 404,
      "meaning": "Unknown path."
    },
    {
      "code": "rate_limited",
      "http": 429,
      "meaning": "Too many requests. Wait for the number of seconds in Retry-After."
    },
    {
      "code": "internal",
      "http": 500,
      "meaning": "Something went wrong on our side."
    },
    {
      "code": "wallet_unavailable",
      "http": 503,
      "meaning": "The wallet balance could not be read right now. Retry shortly."
    }
  ],
  "x-try-it": {
    "keyless": true,
    "operations": [
      "listConnectionProviders",
      "getConnectionsByAddress",
      "getConnectionsBatch",
      "getConnectionByHandle",
      "getAttestationKey",
      "getSdkManifest"
    ],
    "note": "These GET calls need no credential and may be read by a page on any site. The sign-in endpoints, the discovery document, the configuration file and the profile are not on the list: browsers on other sites cannot read them, so the hub shows curl for those."
  }
}
