Profiles
Create a profile
A profile keeps one of your customers' accounts apart from the rest of the workspace.
POST
/v1/profilesTL;DR
| Question | Answer |
|---|---|
| What does it do? | Create a profile. |
| What does it need? | An API key or an OAuth access token. |
| What does it take? | A JSON body with the fields below, and idempotency-key in a header. |
| What does it return? | Status 201 with a body of type Profile. |
| In the SDK? | flung.profiles.create() |
| As an MCP tool? | create_profile |
| What can go wrong? | 401 Missing, unknown, revoked or expired API key; 409 Another profile already has this external id; 422 The request failed validation; 429 Too many requests for this credential; wait for retry-after seconds. Every failure has the same error shape. |
What it does
A profile keeps one of your customers' accounts apart from the rest of the workspace. Make a connect token with its profileId, and the accounts that customer connects join it; list them with GET /v1/accounts?profileId=.
Example
curl
curl -X POST 'https://api.flung.dev/v1/profiles' \ --header "Authorization: Bearer $FLUNG_API_KEY" \ --header 'Content-Type: application/json' \ --header "Idempotency-Key: $(uuidgen)" \ --data '{ "name": "Acme Studio", "externalId": "user_8412"}'ts
import { Flung } from '@flung.dev/sdk'
const flung = new Flung({ apiKey: process.env.FLUNG_API_KEY! })const result = await flung.profiles.create({ name: 'Acme Studio', externalId: 'user_8412',})js
const response = await fetch('https://api.flung.dev/v1/profiles', { method: 'POST', headers: { 'Authorization': `Bearer ${process.env.FLUNG_API_KEY}`, 'Content-Type': 'application/json', 'Idempotency-Key': crypto.randomUUID(), }, body: JSON.stringify({ name: 'Acme Studio', externalId: 'user_8412', }),})if (!response.ok) throw new Error((await response.json()).error.message)const result = await response.json()A successful answer looks like this:
json
{ "id": "prof_aaaaaaaaaaaaaaaaaaaaaaaa", "name": "string", "externalId": "string", "createdAt": "2026-11-01T09:00:00.000Z", "updatedAt": "2026-11-01T09:00:00.000Z"}Header parameters
| Field | Type | Required | Description |
|---|---|---|---|
idempotency-key | string | no | Any unique string, such as a UUID. A retry with the same key and body within 24 hours gets the first answer instead of running again. |
Request body
The body has the type an object, with the fields below.
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | A name for people to read, such as your customer's name. Letters and digits of every script, spaces, and - _ . ' & ( ) +. No emoji, other symbols or invisible characters. Runs of spaces become one and the ends are trimmed. It must hold a letter or a digit, and may not be profane. at least 1 character; at most 200 characters. |
externalId | string | no | Your own id for this customer, such as their user id. Unique in the workspace, so you can find the profile again by it. at least 1 character; at most 255 characters. |
Responses
| Status | Meaning | Body |
|---|---|---|
| 201 | The profile. | Profile |
| 401 | Missing, unknown, revoked or expired API key. | Error |
| 409 | Another profile already has this external id. | Error |
| 422 | The request failed validation. | Error |
| 429 | Too many requests for this credential; wait for retry-after seconds. | Error |
Response body
A 201 answer has the type Profile.
| Field | Type | Required | Description |
|---|---|---|---|
id | string | yes | |
name | string | yes | |
externalId | string | null | yes | |
createdAt | string | yes | |
updatedAt | string | yes |
See also
| Doc | Why |
|---|---|
| API reference | Every endpoint |
| Schemas | Every request and response type |
| Errors | Every error code and what to do about it |
create_profile | The same operation as an MCP tool |