---
title: Calculate amount of Social Security benefits subject to income taxes
slug: calculate-amount-of-social-security-benefits-subject-to-income-taxes
docTags: 
createdAt: 2023-11-11T16:06:16.034Z
---

{
  "id": "X6xTjgESDeGzdxNimTbG4",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://osifinance.com/api/v1/social-security-taxable-amount",
    "servers": [
      {
        "url": "https://osifinance.com/api/v1/social-security-taxable-amount"
      }
    ],
    "name": "Calculate amount of Social Security benefits subject to income taxes",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "Parameters for calculating percentage of Social Security benefits subject to income taxes",
          "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": "filing_status",
              "kind": "optional",
              "type": "string",
              "description": "Filing status for taxes.",
              "default": "single",
              "modelRef": "#/components/schemas/FilingStatus",
              "customType": "FilingStatus",
              "schema": []
            },
            {
              "name": "pmi",
              "kind": "optional",
              "type": "integer",
              "description": "Monthly Social Security benefits.",
              "default": 0,
              "modelRef": "#/components/schemas/Pmi",
              "customType": "Pmi",
              "schema": []
            },
            {
              "name": "federal_agi",
              "kind": "optional",
              "type": "integer",
              "description": "Federal adjusted gross income (agi).",
              "default": 75000,
              "modelRef": "#/components/schemas/FederalAgi",
              "customType": "FederalAgi",
              "schema": []
            },
            {
              "name": "capital_gains_short",
              "kind": "optional",
              "type": "integer",
              "description": "Short term capital gains.",
              "default": 0,
              "modelRef": "#/components/schemas/CapitalGainsShort",
              "customType": "CapitalGainsShort",
              "schema": []
            },
            {
              "name": "dependents",
              "kind": "optional",
              "type": "integer",
              "description": "Number of dependents.",
              "default": 0,
              "modelRef": "#/components/schemas/Dependents",
              "customType": "Dependents",
              "schema": []
            },
            {
              "name": "birth_year",
              "kind": "optional",
              "type": "integer",
              "description": "Year of birth.",
              "default": 1990,
              "modelRef": "#/components/schemas/BirthYear",
              "customType": "BirthYear",
              "schema": []
            },
            {
              "name": "filersOver65",
              "kind": "optional",
              "type": "integer",
              "description": "Number of filers over 65.",
              "default": 0,
              "modelRef": "#/components/schemas/FilersOver65",
              "customType": "FilersOver65",
              "schema": []
            },
            {
              "name": "traditional_esp_contributions",
              "kind": "optional",
              "type": "integer",
              "description": "Traditional employer sponsored plan contributions (401(k), 429(b), 457(b)).",
              "default": 0,
              "modelRef": "#/components/schemas/TraditionalEspContributions",
              "customType": "TraditionalEspContributions",
              "schema": []
            },
            {
              "name": "traditional_ira_contributions",
              "kind": "optional",
              "type": "integer",
              "description": "Traditional IRA contributions.",
              "default": 0,
              "modelRef": "#/components/schemas/TraditionalIraContributions",
              "customType": "TraditionalIraContributions",
              "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": "Taxed",
                    "kind": "optional",
                    "type": "number<double>",
                    "description": "Amount of Social Security benefits subject to income taxes",
                    "example": ""
                  },
                  {
                    "name": "Untaxed",
                    "kind": "optional",
                    "type": "number<double>",
                    "description": "Amount of Social Security benefits not subject to income taxes",
                    "example": ""
                  },
                  {
                    "name": "Total",
                    "kind": "optional",
                    "type": "integer<integer>",
                    "description": "Total amount of Social Security benefits",
                    "example": 0
                  },
                  {
                    "name": "Percent Taxed",
                    "kind": "optional",
                    "type": "number<double>",
                    "description": "Percentage of Social Security benefits subject to income taxes",
                    "example": ""
                  }
                ]
              },
              {
                "name": "sources",
                "kind": "optional",
                "type": "object",
                "description": "List of sources for each tax type",
                "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": "TGrCzMHnXGyZBw2P9HdY_",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://osifinance.com/api/v1/social-security-taxable-amount \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"api_key\": \"\",\n     \"filing_status\": \"single\",\n     \"federal_agi\": 75000,\n     \"birth_year\": 1990\n     }'"
        },
        {
          "id": "VL7ZqKTuNX31UPXVI-f-m",
          "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   \"filing_status\": \"single\",\n   \"federal_agi\": 75000,\n   \"birth_year\": 1990\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-taxable-amount\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "gtVnItOzGPmJmxkQ1F5Dp",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://osifinance.com/api/v1/social-security-taxable-amount\")\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   \"filing_status\": \"single\",\n   \"federal_agi\": 75000,\n   \"birth_year\": 1990\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "k7Kuohvi9f1-RP0WviG7k",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://osifinance.com/api/v1/social-security-taxable-amount\"\n\npayload = json.dumps({\n   \"api_key\": \"\",\n   \"filing_status\": \"single\",\n   \"federal_agi\": 75000,\n   \"birth_year\": 1990\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": "TGrCzMHnXGyZBw2P9HdY_"
    },
    "results": {
      "languages": [
        {
          "id": "0kYj8YtYWhMu_a4UB3WWW",
          "language": "200",
          "code": "// OK\n{\n  \"status\": \"\",\n  \"data\": {\n    \"Taxed\": \"\",\n    \"Untaxed\": \"\",\n    \"Total\": \"\",\n    \"Percent Taxed\": \"\"\n  },\n  \"sources\": {}\n}"
        },
        {
          "id": "5ypXtnNayLGqGQBy7u9Sd",
          "language": "400",
          "code": "// Bad request\n{\n  \"error\": \"\"\n}"
        },
        {
          "id": "sMahOGCJx8YsvQE7wnOXc",
          "language": "401",
          "code": "// Unauthorized\n{\n  \"error\": \"\"\n}"
        },
        {
          "id": "jDEZH9DC3WsDqYT9zVj4I",
          "language": "404",
          "code": "// Not found\n{\n  \"error\": \"\"\n}"
        },
        {
          "id": "5FOPTWTcw-e_f59ti9C8P",
          "language": "429",
          "code": "// Too Many Requests\n{\n  \"error\": \"\"\n}"
        },
        {
          "id": "33YtCaBY_l2Sbl6_60834",
          "language": "500",
          "code": "// Internal server error\n{\n  \"error\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "0kYj8YtYWhMu_a4UB3WWW"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}