---
title: Calculate Social Security benefits
slug: calculate-social-security-benefits
docTags: 
createdAt: 2023-11-11T16:06:16.034Z
---

{
  "id": "fy-q6pdB7MnvQi2DzXHvR",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://osifinance.com/api/v1/social-security-benefits",
    "servers": [
      {
        "url": "https://osifinance.com/api/v1/social-security-benefits"
      }
    ],
    "name": "Calculate Social Security benefits",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "Parameters for calculating Social Security benefits",
          "schema": [
            {
              "name": "api_key",
              "kind": "required",
              "type": "string",
              "description": "API key needed to authorize requests",
              "modelRef": "#/components/schemas/ApiKey",
              "customType": "ApiKey",
              "schema": []
            },
            {
              "name": "sources",
              "kind": "optional",
              "type": "boolean",
              "description": "Whether to include sources for the specific endpoint",
              "default": false,
              "modelRef": "#/components/schemas/Sources",
              "customType": "Sources",
              "schema": []
            },
            {
              "name": "salary",
              "kind": "optional",
              "type": "integer",
              "description": "Salary from employer or self-employment (ie. W2).",
              "default": 100000,
              "modelRef": "#/components/schemas/Salary",
              "customType": "Salary",
              "schema": []
            }
          ],
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "OK",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "schema": [
              {
                "name": "status",
                "kind": "optional",
                "type": "string<success>",
                "example": ""
              },
              {
                "name": "data",
                "kind": "optional",
                "type": "object",
                "example": "",
                "schema": [
                  {
                    "name": "Age 62",
                    "kind": "optional",
                    "type": "number<double>",
                    "description": "The amount of social security benefits received at an election age of 62",
                    "example": ""
                  },
                  {
                    "name": "Age 67",
                    "kind": "optional",
                    "type": "number<double>",
                    "description": "The amount of social security benefits received at the normal or full retirement election age of 67",
                    "example": ""
                  },
                  {
                    "name": "Age 70",
                    "kind": "optional",
                    "type": "number<double>",
                    "description": "The amount of social security benefits received at an election age 70",
                    "example": ""
                  }
                ]
              },
              {
                "name": "sources",
                "kind": "optional",
                "type": "object",
                "description": "Sources type and text for relevant articles and IRS publications",
                "example": "",
                "schema": []
              }
            ],
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Bad request",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "schema": [
              {
                "name": "error",
                "kind": "optional",
                "type": "string",
                "description": "Error message",
                "example": ""
              }
            ],
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "401",
        "description": "Unauthorized",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "schema": [
              {
                "name": "error",
                "kind": "optional",
                "type": "string<No API key provided. Please provide an API Key. | Invalid API key provided. Please register at https://osifinance.com/signup to get a valid API key.>",
                "description": "Error message",
                "example": ""
              }
            ],
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "404",
        "description": "Not found",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "schema": [
              {
                "name": "error",
                "kind": "optional",
                "type": "string",
                "description": "Error message",
                "example": ""
              }
            ],
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "429",
        "description": "Too Many Requests",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "schema": [
              {
                "name": "error",
                "kind": "optional",
                "type": "string<Usage Limit Reached. You have reached the maximum number of daily requests for your account. You can get a higher limit by upgrading to a paid plan or through our give2get program. Learn more at https://osifinance.com/resources/help/give2get?question=How%20can%20I%20get%20free,%20unlimited%20access%20to%20the%20API%20and%20calculators?.>",
                "description": "Error message",
                "example": ""
              }
            ],
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "500",
        "description": "Internal server error",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "schema": [
              {
                "name": "error",
                "kind": "optional",
                "type": "string",
                "description": "Error message",
                "example": ""
              }
            ],
            "isExpanded": true
          }
        ]
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "aNgorRIsmVFrfzLyyb8MH",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://osifinance.com/api/v1/social-security-benefits \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"api_key\": \"\",\n     \"salary\": 100000\n     }'"
        },
        {
          "id": "YsxZcOj2F5p7GTrJieSsQ",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"api_key\": \"\",\n   \"salary\": 100000\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://osifinance.com/api/v1/social-security-benefits\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "ZUq94NkP9MlcfpSq3_Rfl",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://osifinance.com/api/v1/social-security-benefits\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"api_key\": \"\",\n   \"salary\": 100000\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "IYOXw5oU9G93gOTj5qdlW",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://osifinance.com/api/v1/social-security-benefits\"\n\npayload = json.dumps({\n   \"api_key\": \"\",\n   \"salary\": 100000\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "aNgorRIsmVFrfzLyyb8MH"
    },
    "results": {
      "languages": [
        {
          "id": "7zGSqYc6TtP2o9ZCHOvcd",
          "language": "200",
          "code": "// OK\n{\n  \"status\": \"\",\n  \"data\": {\n    \"Age 62\": \"\",\n    \"Age 67\": \"\",\n    \"Age 70\": \"\"\n  },\n  \"sources\": {}\n}"
        },
        {
          "id": "ik0NUWvIntHnMaxgxKQNr",
          "language": "400",
          "code": "// Bad request\n{\n  \"error\": \"\"\n}"
        },
        {
          "id": "slCgqVj1hpAdR_qh5peK5",
          "language": "401",
          "code": "// Unauthorized\n{\n  \"error\": \"\"\n}"
        },
        {
          "id": "0rzCtgX0WU16_4k5drmBr",
          "language": "404",
          "code": "// Not found\n{\n  \"error\": \"\"\n}"
        },
        {
          "id": "e-Fhm2PLH2LtkeICvHWxq",
          "language": "429",
          "code": "// Too Many Requests\n{\n  \"error\": \"\"\n}"
        },
        {
          "id": "OhCNndWVUjOFzSKFj4asX",
          "language": "500",
          "code": "// Internal server error\n{\n  \"error\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "7zGSqYc6TtP2o9ZCHOvcd"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}