Managing Serverless Endpoints via GraphQL

This guide shows how to create, update, view, and delete Serverless Endpoints on Tensor One using the GraphQL API.

Required Arguments

When creating a Serverless Endpoint, the following fields are required:
  • gpuIds – The GPU type to allocate (e.g., AMPERE_16)
  • name – Unique name of the endpoint
  • templateId – The ID of the serverless-compatible template
All other arguments are optional and default to system-configured values if omitted.

Create a Serverless Endpoint

curl --request POST \
--header 'content-type: application/json' \
--url 'https://api.tensorone.ai/graphql?api_key=${YOUR_API_KEY}' \
--data '{
  "query": "mutation {
    saveEndpoint(input: {
      gpuIds: \"AMPERE_16\",
      idleTimeout: 5,
      locations: \"US\",
      name: \"Generated Endpoint -fb\",
      networkVolumeId: \"\",
      scalerType: \"QUEUE_DELAY\",
      scalerValue: 4,
      templateId: \"xkhgg72fuo\",
      workersMax: 3,
      workersMin: 0
    }) {
      gpuIds id idleTimeout locations name scalerType scalerValue templateId workersMax workersMin
    }
  }"
}'

Modify an Existing Serverless Endpoint

curl --request POST \
--header 'content-type: application/json' \
--url 'https://api.tensorone.ai/graphql?api_key=${YOUR_API_KEY}' \
--data '{
  "query": "mutation {
    saveEndpoint(input: {
      id: \"i02xupws21hp6i\",
      gpuIds: \"AMPERE_16\",
      name: \"Generated Endpoint -fb\",
      templateId: \"xkhgg72fuo\",
      workersMax: 0
    }) {
      id gpuIds name templateId workersMax
    }
  }"
}'

View Your Endpoints

curl --request POST \
--header 'content-type: application/json' \
--url 'https://api.tensorone.ai/graphql?api_key=${YOUR_API_KEY}' \
--data '{
  "query": "query Endpoints {
    myself {
      endpoints {
        gpuIds id idleTimeout locations name networkVolumeId
        clusters { desiredStatus }
        scalerType scalerValue templateId workersMax workersMin
      }
      serverlessDiscount {
        discountFactor type expirationDate
      }
    }
  }"
}'

Delete a Serverless Endpoint

Note: workersMin and workersMax must both be set to 0 before deletion.
curl --request POST \
--header 'content-type: application/json' \
--url 'https://api.tensorone.ai/graphql?api_key=${YOUR_API_KEY}' \
--data '{
  "query": "mutation {
    deleteEndpoint(id: \"i02xupws21hp6i\")
  }"
}'