{
  "openapi": "3.1.0",
  "info": {
    "title": "Hybrid ID Linked Steam Account API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://auth.hybrid-id.com"
    }
  ],
  "externalDocs": {
    "url": "https://hybrid-id.com/integrations/linked-accounts.md"
  },
  "components": {
    "securitySchemes": {
      "ClientBasic": {
        "type": "http",
        "scheme": "basic",
        "description": "Registered application client ID and secret. Body access_token must belong to this application and include openid linked:steam."
      }
    },
    "schemas": {
      "SteamLink": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schema",
          "issuer",
          "client_id",
          "subject",
          "state",
          "observed_at",
          "valid_until"
        ],
        "properties": {
          "schema": {
            "const": "hybrid.linked-steam.v1"
          },
          "issuer": {
            "type": "string",
            "format": "uri"
          },
          "client_id": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "state": {
            "enum": [
              "linked",
              "not_linked"
            ]
          },
          "steam_id": {
            "type": "string",
            "pattern": "^[0-9]{17}$"
          },
          "linked_at": {
            "type": "string",
            "format": "date-time"
          },
          "observed_at": {
            "type": "integer"
          },
          "valid_until": {
            "type": "integer",
            "description": "At most 60 seconds after observed_at."
          }
        },
        "oneOf": [
          {
            "properties": {
              "state": {
                "const": "linked"
              }
            },
            "required": [
              "steam_id",
              "linked_at"
            ]
          },
          {
            "properties": {
              "state": {
                "const": "not_linked"
              }
            },
            "not": {
              "anyOf": [
                {
                  "required": [
                    "steam_id"
                  ]
                },
                {
                  "required": [
                    "linked_at"
                  ]
                }
              ]
            }
          }
        ]
      }
    }
  },
  "paths": {
    "/accounts/steam": {
      "post": {
        "operationId": "readLinkedSteam",
        "summary": "Read the authenticated user\u2019s explicitly shared Steam ID",
        "security": [
          {
            "ClientBasic": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "subject",
                  "access_token"
                ],
                "properties": {
                  "subject": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "access_token": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4096
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Current consented link or explicit not_linked. Never cache across accounts.",
            "headers": {
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, no-store"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SteamLink"
                }
              }
            }
          },
          "400": {
            "description": "invalid_request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error",
                    "message"
                  ],
                  "properties": {
                    "error": {
                      "const": "invalid_request"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "invalid_client",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error",
                    "message"
                  ],
                  "properties": {
                    "error": {
                      "const": "invalid_client"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "access_denied",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error",
                    "message"
                  ],
                  "properties": {
                    "error": {
                      "const": "access_denied"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "405": {
            "description": "method_not_allowed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error",
                    "message"
                  ],
                  "properties": {
                    "error": {
                      "const": "method_not_allowed"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "request_too_large",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error",
                    "message"
                  ],
                  "properties": {
                    "error": {
                      "const": "request_too_large"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error",
                    "message"
                  ],
                  "properties": {
                    "error": {
                      "const": "rate_limited"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "temporarily_unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error",
                    "message"
                  ],
                  "properties": {
                    "error": {
                      "const": "temporarily_unavailable"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
