# Save an enemy team

Section: Your data › PVP tracker › Enemy teams

```
POST https://ba.joexyz.online/api/v1/me/pvp/seasons/:seasonId/enemy-teams
```

Saves an enemy team, optionally for an opponent (`enemyPresetId`).
`matchType` is `attack`, `defense` or `both`. Saving the same students
for the same opponent again updates the existing team.

**Parameters**

- `seasonId` (path): The season id.

## Authentication

Bearer Token — `Authorization: Bearer <token>` (inherited from folder "Your data")

## Path parameters

| Name | Value |
| --- | --- |
| `seasonId` |  |

## Headers

| Name | Value |
| --- | --- |
| `Content-Type` | `application/json` |

## Body

Content type: `application/json`

```json
{
  "enemyPresetId": "md72rqbddfd4jdhq9e32xxq62n8e81q1",
  "matchType": "defense",
  "team": [
    {
      "studentId": "iori"
    },
    {
      "studentId": "eimi"
    },
    {
      "studentId": "hoshino_battle_dealer"
    },
    {
      "studentId": "hoshino"
    },
    {
      "studentId": "michiru_dress"
    },
    {
      "studentId": "atsuko_swimsuit"
    }
  ]
}
```

## Example responses

### 201 Created

```json
{
  "data": {
    "id": "mx79k2hd4rqf3wv8ntc6e1jpbs8g5y0a",
    "createdAt": "2026-09-25T21:42:13.511Z",
    "seasonId": "kh73y62jqqhmwbxbnrtpdfe7w18dydwx",
    "enemyPresetId": "md72rqbddfd4jdhq9e32xxq62n8e81q1",
    "teamKey": "8dab5837290edda8",
    "team": [
      {
        "studentId": "iori"
      },
      {
        "studentId": "eimi"
      },
      {
        "studentId": "hoshino_battle_dealer"
      },
      {
        "studentId": "hoshino"
      },
      {
        "studentId": "michiru_dress"
      },
      {
        "studentId": "atsuko_swimsuit"
      }
    ],
    "matchType": "defense",
    "updatedAt": 1790372533511
  }
}
```

## Examples

### cURL

```bash
curl -X POST https://ba.joexyz.online/api/v1/me/pvp/seasons/:seasonId/enemy-teams \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {{api_key}}' \
  --data-raw '{
  "enemyPresetId": "md72rqbddfd4jdhq9e32xxq62n8e81q1",
  "matchType": "defense",
  "team": [
    {
      "studentId": "iori"
    },
    {
      "studentId": "eimi"
    },
    {
      "studentId": "hoshino_battle_dealer"
    },
    {
      "studentId": "hoshino"
    },
    {
      "studentId": "michiru_dress"
    },
    {
      "studentId": "atsuko_swimsuit"
    }
  ]
}'
```

### JavaScript

```javascript
const response = await fetch("https://ba.joexyz.online/api/v1/me/pvp/seasons/:seasonId/enemy-teams", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer {{api_key}}",
  },
  body: JSON.stringify({
    "enemyPresetId": "md72rqbddfd4jdhq9e32xxq62n8e81q1",
    "matchType": "defense",
    "team": [
      {
        "studentId": "iori"
      },
      {
        "studentId": "eimi"
      },
      {
        "studentId": "hoshino_battle_dealer"
      },
      {
        "studentId": "hoshino"
      },
      {
        "studentId": "michiru_dress"
      },
      {
        "studentId": "atsuko_swimsuit"
      }
    ]
  }),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

url = "https://ba.joexyz.online/api/v1/me/pvp/seasons/:seasonId/enemy-teams"
headers = {
    "Authorization": "Bearer {{api_key}}",
}
payload = {
    "enemyPresetId": "md72rqbddfd4jdhq9e32xxq62n8e81q1",
    "matchType": "defense",
    "team": [
        {
            "studentId": "iori",
        },
        {
            "studentId": "eimi",
        },
        {
            "studentId": "hoshino_battle_dealer",
        },
        {
            "studentId": "hoshino",
        },
        {
            "studentId": "michiru_dress",
        },
        {
            "studentId": "atsuko_swimsuit",
        },
    ],
}

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

### Go

```go
package main

import (
	"fmt"
	"io"
	"net/http"
	"strings"
)

func main() {
	body := strings.NewReader(`{
  "enemyPresetId": "md72rqbddfd4jdhq9e32xxq62n8e81q1",
  "matchType": "defense",
  "team": [
    {
      "studentId": "iori"
    },
    {
      "studentId": "eimi"
    },
    {
      "studentId": "hoshino_battle_dealer"
    },
    {
      "studentId": "hoshino"
    },
    {
      "studentId": "michiru_dress"
    },
    {
      "studentId": "atsuko_swimsuit"
    }
  ]
}`)

	req, err := http.NewRequest("POST", "https://ba.joexyz.online/api/v1/me/pvp/seasons/:seasonId/enemy-teams", body)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("Authorization", "Bearer {{api_key}}")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	data, _ := io.ReadAll(res.Body)
	fmt.Println(string(data))
}
```
