UpStudy API Documentation

Introduction

UpStudy API is a powerful mathematical problem-solving tool that supports multiple languages, offering quick solutions and detailed step-by-step breakdowns. It caters to educators, researchers, and developers."

*We are currently offering a limited-time free trial.

Quick Start

1. Register and Create an API Key

  1. Visit the UpStudy API Portal and sign up for an account.
  1. After logging in, navigate to the Settings page.
  1. Click on "New API Key" to generate your unique API key.
  1. Store your API key securely - you'll need it for all API requests.

2. Make Your First API Request

2.1 Prerequisites

Ensure you have the following:

2.2 Using HTTP Requests

curl example:

curl -X 'POST' \
    'https://api.cameramath.com/v1/single-answer' \
    -H 'accept: application/json' \
    -H 'Authorization: YOUR_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
    "input": "x^{2}-3x-4=0",
    "lang": "EN"
  }'

Replace YOUR_API_KEY with the actual API key you generated.

3. Handling API Responses

When working with the API, you'll encounter varied and complex response data structures. For simplified integration, you can use the SDKs mentioned earlier. For those who prefer to handle responses directly via HTTP, the following sections provide detailed explanations and examples.

3.1 Definition of Response Structures (HTTP)


  type V1SingleAnswerPost200Response struct {
    Data *SolverSelfSimpleResponse `json:"data,omitempty"`
    ErrMsg *string `json:"err_msg,omitempty"`
  }
  type V1BriefAnswersPost200Response struct {
    Data *SolverSelfBriefResponse `json:"data,omitempty"`
    ErrMsg *string `json:"err_msg,omitempty"`
  }
  type V1ShowStepsPost200Response struct {
    Data *SolverSelfFullResponseText `json:"data,omitempty"`
    ErrMsg *string `json:"err_msg,omitempty"`
  }
  type SolverSelfSimpleResponse struct {
    Input *string `json:"input,omitempty"`
    Solution *SolverSolution `json:"solution,omitempty"`
  }
  type SolverSelfBriefResponse struct {
    Input *string `json:"input,omitempty"`
    Solutions []SolverSolution `json:"solutions,omitempty"`
  }
  type SolverSelfFullResponseText struct {
    Input *string `json:"input,omitempty"`
    Solutions []SolverSolutionWithSolvingSteps `json:"solutions,omitempty"`
  }
  type SolverSolution struct {
    BlockName *SolverDescription `json:"block_name,omitempty"`
    Results []SolverStep `json:"results,omitempty"`
    SolutionName *SolverDescription `json:"solution_name,omitempty"`
  }
  type SolverSolutionWithSolvingSteps struct {
    BlockName *SolverDescription `json:"block_name,omitempty"`
    Results []SolverStep `json:"results,omitempty"`
    SolutionName *SolverDescription `json:"solution_name,omitempty"`
    SolvingSteps []SolverStep `json:"solving_steps,omitempty"`
  }
  type SolverDescription struct {
    Content *string `json:"content,omitempty"`
    Format *SolverDescriptionFormat `json:"format,omitempty"`
  }
  type SolverStep struct {
    Children []SolverStep `json:"children,omitempty"`
    Description *SolverDescription `json:"description,omitempty"`
    ImageUrl *string `json:"image_url,omitempty"`
    Latex *string `json:"latex,omitempty"`
  }
  type SolverDescriptionFormat string
  const (
    TXT SolverDescriptionFormat = "txt"
    LATEX SolverDescriptionFormat = "latex"
  )

3.2 Access to show-steps API endpoint (HTTP)

package main
  
  import (
    "encoding/json"
    "fmt"
  )
  
  /... The structures defined above/
  
  
  func main() {
  url := "https://api.cameramath.com/v1/show-steps"
    appKeyID := "<replace_to_your_api_key>" // replace to your api key
  
    reqBody := map[string]string{
      "input":  "x+1=2",
      "lang":   "EN",
    }
  
    jsonReqBody, err := json.Marshal(reqBody)
    must(err)
  
    req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonReqBody))
    must(err)
  
    req.Header.Set("Accept", "application/json")
    req.Header.Set("Authorization", apiKey)
    req.Header.Set("Content-Type", "application/json")
  
    client := &http.Client{}
    resp, err := client.Do(req)
    must(err)
    defer resp.Body.Close()
    if resp.StatusCode != http.StatusOK {
      fmt.Printf("Error: received non-200 status code: %d\n", resp.StatusCode)
      return
    }
  
    body, err := ioutil.ReadAll(resp.Body)
    must(err)
    var response V1ShowStepsPost200Response
    must(json.Unmarshal(body, &response))
    fmt.Printf("Response: %+v\n", response)
  }
  func must(err error) {
    if err != nil {
      panic(err)
    }
  }
  

To call the single or brief API endpoints instead of the show-steps API endpoint, you need to make the following changes:

  1. Modify the URL endpoint:
    • For the single API endpoint, change the url variable to https://api.cameramath.com/v1/single-answer.
    • For the brief API endpoint, change the url variable to https://api.cameramath.com/v1/brief-answers.
  1. Update the response handling:
    • For the single API endpoint, modify the response structure to use V1SingleAnswerPost200Response.
    • For the brief API endpoint, modify the response structure to use V1BriefAnswersPost200Response.

Other parts of the code, including constructing the request body, setting request headers, and processing the response, remain unchanged.

3.3 API Response Structure Explanation (HTTP/SDK)

Struct:V1SingleAnswerPost200Response

JSON FieldStruct FieldTypeDescription
dataData*SolverSelfSimpleResponseContains the main response object with the input and a simple answer to the most important topic.
err_msgErrMsg*stringError message string

Struct:V1BriefAnswersPost200Response

JSON FieldStruct FieldTypeDescription
dataData*SolverSelfBriefResponseContains the main response object with the input and a brief answer to multiple topics.
err_msgErrMsg*stringError message string

Struct:V1ShowStepsPost200Response

JSON FieldStruct FieldTypeDescription
dataData*SolverSelfFullResponseTextContains the main response object with the input and step-by-step answers for multiple topics.
err_msgErrMsg*stringError message string

Struct: SolverSelfSimpleResponse

JSON FieldStruct FieldTypeDescription
inputInput*stringThe user's input in LaTeX format
solutionSolution*SolverSolutionThe solution we believe the user most likely wants

Struct: SolverSelfBriefResponse

JSON FieldStruct FieldTypeDescription
inputInput*stringThe user's input in LaTeX format
solutionsSolutions[]SolverSolutionContains all the solutions we can provide

Struct: SolverSelfFullResponseText

JSON FieldStruct FieldTypeDescription
inputInput*stringThe user's input in LaTeX format
solutionsSolutions[]SolverSolutionWithSolvingStepsContains all the solutions along with the steps to achieve them

Struct: SolverSolutionWithSolvingSteps

JSON FieldStruct FieldTypeDescription
block_nameBlockName*SolverDescriptionBlock name, e.g., Function/Solve the equation
resultsResults[]SolverStepThe answers, potentially multiple, for instance, \(\frac{1}{4}, 0.25\)
solution_nameSolutionName*SolverDescriptionThe specific name of the solution under the block type, e.g., Block: Function, Solution: Find the slope
solving_stepsSolvingSteps[]SolverStepThe steps to achieve the solution

Struct: SolverSolution

JSON FieldStruct FieldTypeDescription
block_nameBlockName*SolverDescriptionBlock name, e.g., Function/Solve the equation
resultsResults[]SolverStepThe answers, potentially multiple e.g., \(\frac{1}{4}, 0.25\)
solution_nameSolutionName*SolverDescriptionThe specific name of the solution under the block, e.g., Block: Function, Solution: Find the slope

Struct: SolverDescription

JSON FieldStruct FieldTypeDescription
contentContent*stringDescription content
formatFormat*SolverDescriptionFormatFormat of the description content, either txt or latex

Struct: SolverStep

JSON FieldStruct FieldTypeDescription
childrenChildren[]SolverStepSub-steps that supplement how this step leads to the next
descriptionDescription*SolverDescriptionDescription of the current step
image_urlImageUrl*stringIf the step involves a drawing, this will contain the URL of the image
latexLatex*stringThe LaTeX representation of the current step

Enum: SolverDescriptionFormat

Enum ValueDescription
TXTText format
LATEXLaTeX format

SDKs

UpStudy provides Software Development Kits (SDKs) for various programming languages to aid seamless integration. Access the SDKs through the respective GitHub repositories:

1. Go

Github repo : GitHub Link

Examples:

2. Python

Github repo : GitHub Link

Examples:

API Endpoints

The UpStudy API provides three primary endpoints to cater to different mathematical problem-solving needs. Each endpoint offers unique features and response structures. Below, you can see details about each endpoint, their request parameters, example requests, and response structures.

1. Single Answer

1.1 Endpoint

1.2 Request Parameters

1.3 Response Example

{
    "data": {
      "input": "x+1=2",
      "solution": {
        "block_name": {
          "content": "Solve the equation",
          "format": "txt"
        },
        "solution_name": {
          "content": "\\text{Solve for }x",
          "format": "latex"
        },
        "results": [
          {
            "description": {
              "content": "\\text{Solve for }x",
              "format": "latex"
            },
            "latex": "x=1"
          }
        ]
      }
    }
  }

Field descriptions:

2. Brief Answers

2.1 Endpoint

2.2 Request Parameters

2.3 Response Example

{
    "data": {
      "input": "x+1=2",
      "solutions": [
        {
          "block_name": {
            "content": "Solve the equation",
            "format": "txt"
          },
          "solution_name": {
            "content": "\\text{Solve for }x",
            "format": "latex"
          },
          "results": [
            {
              "description": {
                "content": "\\text{Solve for }x",
                "format": "latex"
              },
              "latex": "x=1"
            }
          ]
        },
        {
          "block_name": {
            "content": "Rewrite the equation",
            "format": "txt"
          },
          "solution_name": {
            "content": "Rewrite in standard form",
            "format": "txt"
          },
          "results": [
            {
              "description": {
                "content": "Rewrite in standard form",
                "format": "txt"
              },
              "latex": "x=1"
            }
          ]
        },
        {
          "block_name": {
            "content": "Graph",
            "format": "txt"
          },
          "solution_name": {
            "content": "Graph the equation",
            "format": "txt"
          },
          "results": [
            {
              "description": {
                "content": "Graph the equation",
                "format": "txt"
              },
              "image_url": "https://static.cameramath.com/yc6uq9vds8/42f35af227a741c838471241303bf53e/72ccbc30081b38d1b1bc8dd2568901f9"
            }
          ]
        }
      ]
    }
  }

Field descriptions:

3. Show steps

3.1 Endpoint

3.2 Request Parameters

3.3 Response Example

{
    "data": {
      "input": "\\log_{4}{\\left(x+1\\right)}=3",
      "solutions": [
        {
          "block_name": {
            "content": "Solve the equation",
            "format": "txt"
          },
          "solution_name": {
            "content": "\\text{Solve for }x",
            "format": "latex"
          },
          "results": [
            {
              "description": {
                "content": "\\text{Solve for }x",
                "format": "latex"
              },
              "latex": "x=63"
            }
          ],
          "solving_steps": [
            {
              "description": {
                "content": "Evaluate",
                "format": "txt"
              },
              "latex": "\\log_{4}{\\left(x+1\\right)}=3",
              "children": [
                {
                  "description": {
                    "content": "Evaluate",
                    "format": "txt"
                  },
                  "latex": "x+1>0"
                },
                {
                  "description": {
                    "content": "Move the constant to the right side",
                    "format": "txt"
                  },
                  "latex": "x>0-1"
                },
                {
                  "description": {
                    "content": "Remove 0",
                    "format": "txt"
                  },
                  "latex": "x>-1"
                }
              ]
            },
            {
              "description": {
                "content": "Find the domain",
                "format": "txt"
              },
              "latex": "\\log_{4}{\\left(x+1\\right)}=3,x>-1"
            },
            {
              "description": {
                "content": "Convert the logarithm into exponential form",
                "format": "txt"
              },
              "latex": "x+1=4^{3}"
            },
            {
              "description": {
                "content": "Evaluate the power",
                "format": "txt"
              },
              "latex": "x+1=64"
            },
            {
              "description": {
                "content": "Move the constant to the right side",
                "format": "txt"
              },
              "latex": "x=64-1"
            },
            {
              "description": {
                "content": "Subtract the numbers",
                "format": "txt"
              },
              "latex": "x=63"
            },
            {
              "description": {
                "content": "Check if the solution is in the defined range",
                "format": "txt"
              },
              "latex": "x=63,x>-1"
            },
            {
              "description": {
                "content": "Find the intersection",
                "format": "txt"
              },
              "latex": "x=63"
            }
          ]
        },
        {
          "block_name": {
            "content": "Graph",
            "format": "txt"
          },
          "solution_name": {
            "content": "Graph the equation",
            "format": "txt"
          },
          "results": [
            {
              "description": {
                "content": "Graph the equation",
                "format": "txt"
              },
              "image_url": "https://static.cameramath.com/yc6uq9vds8/fe62e4ab1839887b234e4d144e54f8ac/485092d15060a9d7b429ae6097208232"
            }
          ],
          "solving_steps": [
            {
              "description": {
                "content": "Evaluate",
                "format": "txt"
              },
              "latex": "x=63"
            },
            {
              "description": {
                "content": "Graph",
                "format": "txt"
              },
              "image_url": "https://static.cameramath.com/yc6uq9vds8/fe62e4ab1839887b234e4d144e54f8ac/485092d15060a9d7b429ae6097208232"
            }
          ]
        }
      ]
    }
  }

Field descriptions:

Exploring the API with Swagger UI

Use the Swagger UI to explore all available API endpoints and their details.

Accessing Swagger UI:

With the Swagger UI, you can:

Error Handling

Response codeDescriptionSolution
400Invalid RequestCheck if the request parameters are correct.
401UnauthorizedEnsure the API key is correct and valid.
429Too Many RequestsReduce the request rate and adhere to the API usage limits.
500Server ErrorRetry after some time; if the issue persists, contact the support team.

The UpStudy API has a rate limit of 30 requests per minute. Exceeding this limit results in a 429 status code (Too Many Requests).

For higher rate limits, please contact [email protected] for customized rate limit options.

Supported Topics and Examples

Below is a table of mathematical topics and subtopics that our API can handle, along with LaTeX examples for each. This can help you understand the range of problems our API can solve and how to format your inputs correctly.

TopicsSub-topicsexamplelatex
Pre AlgebraFractions58+78\frac{5}{8}+\frac{7}{8}\frac{5}{8}+\frac{7}{8}
Decimals7.19×19.617.19\times 19.617.19\times 19.61
Exponents22×252^2\times 2^52^2\times 2^5
Radicals18\sqrt{18}\sqrt{18}
Ratios3:53:53:5
Integer(27+31)×12(27+31)\times 12(27+31)\times 12
Percent18%18\%18\%
AlgebraEquations5x3=525x-3=525x-3=52
Expressions9x24x+16=9x-24x+16=9x-24x+16=
Inequalities3x5>2(x10)3x-5>-2(x-10)3x-5>-2(x-10)
Functionsy=x+7,x=2y=x+7,x=2y=x+7,x=2
Sequences10,8,6,10,8,6,\cdots 10,8,6,\cdots
Logarithmiclog32x=9\log _32x=9\log _32x=9
Complex Number(6+3i)(56i)=(6+3i)(5-6i)=(6+3i)(5-6i)=
Matrices[4532]=\left[\begin{array}{l} {4}&{5}\\{-3}&{2}\end{array}\right]=\left[\begin{array}{l} {4}&{5}\\{-3}&{2}\end{array}\right]=
Pre CalculusEquationsx5+x5=10\frac{x}{5}+\frac{x}{5}=10\frac{x}{5}+\frac{x}{5}=10
Inequalities2x+1>7\left|2x+1\right|>7\left|2x+1\right|>7
Functionsf(x)=x3f(x)=x^3f(x)=x^3
CalculusDerivativesddx(2x5)=\frac{d}{dx}(2x-5)=\frac{d}{dx}(2x-5)=
integrals5xdx=\int _{ }^{ }5xdx=\int _{ }^{ }5xdx=
Limitslimxxx=\lim_{x\rightarrow \infty }\frac{\left|x\right|}{x}=\lim_{x\rightarrow \infty }\frac{\left|x\right|}{x}=
Seriesn=11n(n+1)=\sum _{n=1}^{\infty }\frac{1}{n(n+1)}=\sum _{n=1}^{\infty }\frac{1}{n(n+1)}=
TrigonometryEquationssin(x)cos(x)=0\sin (x)-\cos (x)=0\sin (x)-\cos (x)=0
Inequalitiescos(2x)+2sin2(x)>0\cos (2x)+2\sin ^2(x)>0\cos (2x)+2\sin ^2(x)>0
Functionssin75cos15+sin15cos75=\sin 75^{\circ }\cos 15^{\circ }+\sin 15^{\circ }\cos 75^{\circ }=\sin 75^{\circ }\cos 15^{\circ }+\sin 15^{\circ }\cos 75^{\circ }=
Simplify1+tanθ1+cotθ=tanθ\frac{1+\tan \theta }{1+\cot \theta }=\tan \theta \frac{1+\tan \theta }{1+\cot \theta }=\tan \theta
Prooftanθsecθ=sinθ\frac{\tan \theta }{\sec \theta }=\sin \theta \frac{\tan \theta }{\sec \theta }=\sin \theta
Geometryx236+y29=1\frac{x^2}{36}+\frac{y^2}{9}=1\frac{x^2}{36}+\frac{y^2}{9}=1
Statistics and Probability5!= 5! = 5!=