> ## Documentation Index
> Fetch the complete documentation index at: https://learn.nexudus.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate AI Profile

> Generate an AI-written professional profile summary for the authenticated customer based on their existing profile data.

# Generate AI Profile

Uses OpenAI to generate a professional profile summary for the authenticated customer. The AI drafts the `ProfileSummary` text based on the customer's existing profile fields (name, position, company, tags, etc.). The portal presents the result for the customer to review and accept before saving it via `PATCH /api/public/coworker/profile`.

<Note>
  This endpoint requires the location to have the OpenAI integration enabled. If it is not configured, the AI profile button will not appear in the
  portal UI.
</Note>

## Authentication

Requires a valid customer bearer token.

## Request Body

No body is required. The AI uses the customer's existing profile data from the server session.

```http theme={null}
POST /en/profile/GenerateOpenAiProfile
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...
```

## Response

Returns a `Coworker` object with the `ProfileSummary` field populated with the AI-generated text. The customer's profile is **not** saved automatically — the customer must review and confirm, after which the portal calls `PATCH /api/public/coworker/profile` with `ProfileSummary`.

<ResponseField name="ProfileSummary" type="string | null">
  The AI-generated professional profile summary. May contain Markdown formatting. Presented to the customer for review before saving.
</ResponseField>

<ResponseField name="OpenAiProfileAvailable" type="boolean">
  `true` when AI profile generation is available for this location. Use this to show or hide the "Generate with AI" button.
</ResponseField>

## Example Response

```json theme={null}
{
  "ProfileSummary": "Jane is a product designer with over 8 years of experience building intuitive digital products for SaaS companies. Based at Nexudus Coworking, she specialises in design systems and user research.",
  "OpenAiProfileAvailable": true,
  "FullName": "Jane Doe",
  "Position": "Product Designer",
  "CompanyName": "Acme Design Co."
}
```

## TypeScript Integration

```typescript theme={null}
import endpoints from '@/api/endpoints'
import { Coworker } from '@/types/spaces/Coworker'

const result = await httpClient.post<Coworker>(endpoints.profile.ai)

if (result.data.ProfileSummary) {
  // Present the generated text to the customer for review
  setGeneratedSummary(result.data.ProfileSummary)
}
```

## Usage in Portal

| Context                                               | Source file                                         |
| ----------------------------------------------------- | --------------------------------------------------- |
| Professional profile form — "Generate with AI" button | `src/views/user/components/ProfessionalProfile.tsx` |

## Error Responses

<ResponseField name="401 Unauthorized" type="error">
  The bearer token is missing, expired, or invalid.
</ResponseField>

<ResponseField name="400 Bad Request" type="error">
  The location does not have the OpenAI integration enabled, or the customer's profile lacks sufficient data to generate a summary.
</ResponseField>

## Related Endpoints

| Method  | Endpoint                         | Description                                          |
| ------- | -------------------------------- | ---------------------------------------------------- |
| `PATCH` | `/api/public/coworker/profile`   | Save the reviewed AI summary to the customer profile |
| `GET`   | `/en/profile?_resource=Coworker` | Retrieve full customer profile data                  |
