Skip to main content
POST
/
api
/
testsets
/
{testset_id}
/
rows
[
  {
    "row_data": {
      "input": "sdf"
    }
  },
  {
    "row_data": {
      "expected_output": "ccc"
    }
  }
]
{
  "created": 2,
  "rows": [
    {
      "row_index": 0,
      "row_data": {
        "input": "sdf"
      }
    }
  ]
}
Add rows to a testset.

Authentication

  • API key: Authorization: Bearer <API key>

Path Parameters

testset_id
string
required
The ID of the testset to add rows to.

Request Body

[
  {
    "row_data": {
      "input": "sdf"
    }
  },
  {
    "row_data": {
      "expected_output": "ccc"
    }
  }
]

Examples

import requests

testset_id = "testset_id_123"
url = f"https://api.keywordsai.co/api/testsets/{testset_id}/rows"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}

data = [
    {
        "row_data": {
            "input": "sdf"
        }
    },
    {
        "row_data": {
            "expected_output": "ccc"
        }
    }
]

response = requests.post(url, headers=headers, json=data)
print(response.json())

Response

{
  "created": 2,
  "rows": [
    {
      "row_index": 0,
      "row_data": {
        "input": "sdf"
      }
    }
  ]
}