# How to create a new profile

If you have an ORCID iD but no profile yet (the build pipeline has never made
one for you), you can create one yourself and start editing it right away. To
learn why creation and ownership happen together, see
[Core concepts](/prosopia/concepts.md).

## Prerequisites

- You have an ORCID iD.
- No profile with your ORCID exists yet. If one does, claim it instead. See
  [How to claim your researcher profile](/prosopia/how-to/claim-a-profile.md).

## Steps

1. Log in with ORCID. This redirects you to ORCID and back, then sets your
   session cookie:

    ```
    GET /api/manage/login
    ```

2. Confirm you can create. In the session probe response, `creatable` is `true`
   only when you have no existing profile and no claimable profile:

    ```bash
    curl -b "rp_session=<your-cookie>" https://prosopia.databio.org/api/manage/session
    ```

3. Create the profile. Every field is optional. With an ORCID session you can
   send an empty body; the server uses the name from your login and derives a
   slug:

    ```bash
    curl -b "rp_session=<your-cookie>" \
      -H "Content-Type: application/json" \
      -X POST https://prosopia.databio.org/api/manage/profiles \
      -d '{}'
    ```

    You can also supply a `name` (required if your login provider gave none)
    and a `slug` (a lowercase handle; collisions get a `-2`, `-3`, … suffix):

    ```bash
    curl -b "rp_session=<your-cookie>" \
      -H "Content-Type: application/json" \
      -X POST https://prosopia.databio.org/api/manage/profiles \
      -d '{"name": "Jane A. Doe", "slug": "jane-doe"}'
    ```

    The server writes the owner grant in the same transaction that creates the
    profile, so there is never a moment when the profile exists but nobody owns
    it.

4. Edit the profile right away. The response includes the edit URLs. The new
   profile starts minimal and private (`level: "lite"`,
   `visibility: "internal"`), so it stays off the public plane until you decide
   otherwise:

    ```bash
    curl -b "rp_session=<your-cookie>" \
      -H "Content-Type: application/json" \
      -X PATCH https://prosopia.databio.org/api/v1/profiles/jane-doe/metadata \
      -d '{"field": "Computational Biology", "summary": "I study genomes."}'

    curl -b "rp_session=<your-cookie>" \
      -H "Content-Type: application/json" \
      -X PUT https://prosopia.databio.org/api/v1/profiles/jane-doe/soul \
      -d '{"soul": "# How I think\n"}'
    ```

## What success looks like

Creation returns `201 Created` with the slug, the rid, and the edit URLs:

```json
{
  "slug": "jane-doe",
  "rid": "0000-0002-1825-0097",
  "level": "lite",
  "visibility": "internal",
  "edit_urls": {
    "metadata": "/api/v1/profiles/jane-doe/metadata",
    "soul": "/api/v1/profiles/jane-doe/soul",
    "visibility": "/api/v1/profiles/jane-doe/visibility"
  }
}
```

## What can go wrong

- **`401`**: you are not logged in, or your session expired.
- **`400`**: the server could not determine a name, or the requested `slug` is
  malformed.
- **`409`**: a profile with your ORCID already exists (claim it instead), or the
  `slug` you requested is taken.

## Deleting a profile

You can remove a profile you created by mistake. Only the owner can delete a
profile. Deletion returns `204 No Content`:

```bash
curl -b "rp_session=<your-cookie>" \
  -X DELETE https://prosopia.databio.org/api/manage/profiles/jane-doe
```

## Next steps

- A freshly created profile is an empty shell: no publications, no expertise
  narrative, no embedding index. Fill it in yourself with
  [How to build a profile](/prosopia/how-to/build-on-demand.md).
- To put it on the open web, see
  [How to share your profile](/prosopia/how-to/share-your-profile.md).
