Bulk-create identities
/portal/v1/accounts/{accountSlug}/applications/{appSlug}/identities/bulk-createAuthentication
- Bearer Token
AuthorizationJWT access token
Headers
Idempotency-KeyOptional opaque string the server uses to deduplicate retried requests. When the same key is replayed within 24 hours, the original response (status + body) is returned without re-processing — eliminates duplicate writes from network blips between server commit and client receipt. Generate one per logical operation (UUIDv4 recommended). Max 255 characters.
Request body
identities *CreateIdentityDto[]
Code samples
curl -X POST "https://api.canopy.dev/portal/v1/accounts/{accountSlug}/applications/{appSlug}/identities/bulk-create" \
-H "Idempotency-Key: value" \
-H "Authorization: Bearer $CANOPY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"identities": [
{
"email": "string",
"first_name": "string",
"last_name": "string",
"password": "string",
"external_id": "string",
"metadata": {},
"role_id": "string",
"node_id": "string"
}
]
}'const response = await fetch("https://api.canopy.dev/portal/v1/accounts/{accountSlug}/applications/{appSlug}/identities/bulk-create", {
method: "POST",
headers: {
"Idempotency-Key": "value",
"Authorization": "Bearer $CANOPY_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"identities": [
{
"email": "string",
"first_name": "string",
"last_name": "string",
"password": "string",
"external_id": "string",
"metadata": {},
"role_id": "string",
"node_id": "string"
}
]
}),
});
const data = await response.json();import requests
response = requests.post(
"https://api.canopy.dev/portal/v1/accounts/{accountSlug}/applications/{appSlug}/identities/bulk-create",
headers={
"Idempotency-Key": "value",
"Authorization": "Bearer $CANOPY_TOKEN",
"Content-Type": "application/json"
},
json={
"identities": [
{
"email": "string",
"first_name": "string",
"last_name": "string",
"password": "string",
"external_id": "string",
"metadata": {},
"role_id": "string",
"node_id": "string",
},
],
},
)
data = response.json()package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
payload := map[string]interface{}{
"identities": []interface{}{
map[string]interface{}{
"email": "string",
"first_name": "string",
"last_name": "string",
"password": "string",
"external_id": "string",
"metadata": map[string]interface{}{},
"role_id": "string",
"node_id": "string",
},
},
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://api.canopy.dev/portal/v1/accounts/{accountSlug}/applications/{appSlug}/identities/bulk-create", bytes.NewBuffer(body))
req.Header.Set("Idempotency-Key", "value")
req.Header.Set("Authorization", "Bearer $CANOPY_TOKEN")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
}Responses
200 Per-row identity creation. Each row is processed independently — duplicates and validation errors fail individually without aborting the batch. Returns 200 on full success or 207 Multi-Status on mixed outcomes; the body is always { summary, results } so callers iterate the same way regardless. — all items succeeded
{
"summary": {
"total": 0,
"succeeded": 0,
"failed": 0
},
"results": [
{
"index": 0,
"status": "success",
"code": 0,
"data": {
"id": "string",
"email": "string",
"first_name": "string",
"last_name": "string",
"avatar_url": "string",
"external_id": "string",
"is_active": false,
"created_at": "2026-04-20T12:00:00.000Z"
}
}
]
}application/json
summary *objectresults *object[]
207 Per-row identity creation. Each row is processed independently — duplicates and validation errors fail individually without aborting the batch. Returns 200 on full success or 207 Multi-Status on mixed outcomes; the body is always { summary, results } so callers iterate the same way regardless. — mixed outcomes (one or more items failed)
{
"summary": {
"total": 0,
"succeeded": 0,
"failed": 0
},
"results": [
{
"index": 0,
"status": "success",
"code": 0,
"data": {
"id": "string",
"email": "string",
"first_name": "string",
"last_name": "string",
"avatar_url": "string",
"external_id": "string",
"is_active": false,
"created_at": "2026-04-20T12:00:00.000Z"
}
},
{
"index": 0,
"status": "error",
"code": 0,
"input": {},
"error": {
"code": "string",
"message": "string",
"details": {}
}
}
]
}application/json
summary *objectresults *("success" | "error")[]
401 Invalid or expired token
403 This token is not authorized for this endpoint (wrong principal type — e.g., admin token on identity-only endpoint, or vice versa)