# Patron Registration

Provider API v0.6.6 · 4 operations
Source: https://plasapi.com/provider/v0.6.6/patron-registration/

No description in the specification.

## This will create a new patron, by the given identifier.

`POST` `/patron/registration` · `RegisterPatronByIdentifier`

### Example request

**cURL**

```bash
curl -X POST "$PLAS_BASE_URL/patron/registration?version=0.6.6" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $PLAS_TOKEN" \
  -d '{
  "consents": [
    {
      "type": "loan_history",
      "version": "2025-01"
    }
  ],
  "identifier": {
    "type": "local",
    "value": "N00012345"
  },
  "password": "correct-horse-battery",
  "pickupLocation": {
    "branchId": "nordby-main",
    "sections": [
      {
        "id": "nordby-main-children",
        "type": "department"
      }
    ]
  },
  "registry": "national"
}'
```

**JavaScript**

```javascript
const response = await fetch(`${process.env.PLAS_BASE_URL}/patron/registration?version=0.6.6`, {
  method: "POST",
  headers: {
    "Accept": "application/json",
    "Content-Type": "application/json",
    "Authorization": `Bearer ${process.env.PLAS_TOKEN}`,
  },
  body: JSON.stringify({
    "consents": [
      {
        "type": "loan_history",
        "version": "2025-01"
      }
    ],
    "identifier": {
      "type": "local",
      "value": "N00012345"
    },
    "password": "correct-horse-battery",
    "pickupLocation": {
      "branchId": "nordby-main",
      "sections": [
        {
          "id": "nordby-main-children",
          "type": "department"
        }
      ]
    },
    "registry": "national"
  }),
});
const data = await response.json();
```

**Python**

```python
import os
import requests

response = requests.post(
    f"{os.environ['PLAS_BASE_URL']}/patron/registration",
    params={
        "version": "0.6.6",
    },
    headers={
        "Accept": "application/json",
        "Content-Type": "application/json",
        "Authorization": f"Bearer {os.environ['PLAS_TOKEN']}",
    },
    json={
        "consents": [
            {
                "type": "loan_history",
                "version": "2025-01",
            },
        ],
        "identifier": {
            "type": "local",
            "value": "N00012345",
        },
        "password": "correct-horse-battery",
        "pickupLocation": {
            "branchId": "nordby-main",
            "sections": [
                {
                    "id": "nordby-main-children",
                    "type": "department",
                },
            ],
        },
        "registry": "national",
    },
)
data = response.json()
```

The host and token are environment variables: `PLAS_BASE_URL` the provider’s base URL · `PLAS_TOKEN` an access token.

### Parameters

Shared across operations: `version`. [See the shared contract on the version page.](https://plasapi.com/provider/v0.6.6/)

### Request body

`application/json` · required

[`PatronRegistrationIdentifierRequestBody`](https://plasapi.com/provider/v0.6.6/schemas/#PatronRegistrationIdentifierRequestBody)

### Responses

#### `200` Success

`PatronRegistrationIdentifierResponseBody`

Example (Generated from the schema):

```json
{
  "message": "I accept the library’s terms of use.",
  "patronId": "40218873",
  "status": "done"
}
```

#### `400` The list of errors.

`Errors`

Shared response, defined once for the whole API. [See the shared contract on the version page.](https://plasapi.com/provider/v0.6.6/)

Example (Generated from the schema):

```json
{
  "errors": [
    {
      "code": 200103,
      "info": "200103: invalid/unsupported query parameter value"
    }
  ]
}
```

#### `401` Bearer token invalid, missing, or expired.

No response body.

Shared response, defined once for the whole API. [See the shared contract on the version page.](https://plasapi.com/provider/v0.6.6/)

## This will redirect the user to the chosen identity provider, for signup.

`GET` `/patron/registration/identity-provider` · `GetRegisterPatronUrl`

This will redirect the user to the chosen identity provider, and create the user in the LMS.
[See a sequence flow diagram](https://storage.googleapis.com/open-library-api-files/images/idp.png).


### Example request

**cURL**

```bash
curl -X GET "$PLAS_BASE_URL/patron/registration/identity-provider?type=bankid&version=0.6.6" \
  -H 'Accept: application/json' \
  -H "Authorization: Bearer $PLAS_TOKEN"
```

**JavaScript**

```javascript
const response = await fetch(`${process.env.PLAS_BASE_URL}/patron/registration/identity-provider?type=bankid&version=0.6.6`, {
  method: "GET",
  headers: {
    "Accept": "application/json",
    "Authorization": `Bearer ${process.env.PLAS_TOKEN}`,
  },
});
const data = await response.json();
```

**Python**

```python
import os
import requests

response = requests.get(
    f"{os.environ['PLAS_BASE_URL']}/patron/registration/identity-provider",
    params={
        "type": "bankid",
        "version": "0.6.6",
    },
    headers={
        "Accept": "application/json",
        "Authorization": f"Bearer {os.environ['PLAS_TOKEN']}",
    },
)
data = response.json()
```

The host and token are environment variables: `PLAS_BASE_URL` the provider’s base URL · `PLAS_TOKEN` an access token.

### Parameters

- `type` (In `query`, `string`, required) — Identity provider type. The different types are defined in the /configuration endpoint.

Shared across operations: `version`. [See the shared contract on the version page.](https://plasapi.com/provider/v0.6.6/)

### Responses

#### `200` Success

`PatronRegistrationIdentityProviderResponseBody`

Example (Generated from the schema):

```json
{
  "message": "I accept the library’s terms of use.",
  "patronId": "40218873",
  "status": "done"
}
```

#### `400` The list of errors.

`Errors`

Shared response, defined once for the whole API. [See the shared contract on the version page.](https://plasapi.com/provider/v0.6.6/)

Example (Generated from the schema):

```json
{
  "errors": [
    {
      "code": 200103,
      "info": "200103: invalid/unsupported query parameter value"
    }
  ]
}
```

#### `401` Bearer token invalid, missing, or expired.

No response body.

Shared response, defined once for the whole API. [See the shared contract on the version page.](https://plasapi.com/provider/v0.6.6/)

## Register patron by code and code verifier from SSO registration.

`POST` `/patron/registration/identity-provider` · `RegisterPatronByCodeAndCodeVerifier`

### Example request

**cURL**

```bash
curl -X POST "$PLAS_BASE_URL/patron/registration/identity-provider?version=0.6.6" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $PLAS_TOKEN" \
  -d '{
  "code": "SplxlOBeZQQYbYS6WxSbIA",
  "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk",
  "consents": [
    {
      "type": "loan_history",
      "version": "2025-01"
    }
  ],
  "identity_provider": "norway_id_portal",
  "pickupLocation": {
    "branchId": "nordby-main",
    "sections": [
      {
        "id": "nordby-main-children",
        "type": "department"
      }
    ]
  }
}'
```

**JavaScript**

```javascript
const response = await fetch(`${process.env.PLAS_BASE_URL}/patron/registration/identity-provider?version=0.6.6`, {
  method: "POST",
  headers: {
    "Accept": "application/json",
    "Content-Type": "application/json",
    "Authorization": `Bearer ${process.env.PLAS_TOKEN}`,
  },
  body: JSON.stringify({
    "code": "SplxlOBeZQQYbYS6WxSbIA",
    "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk",
    "consents": [
      {
        "type": "loan_history",
        "version": "2025-01"
      }
    ],
    "identity_provider": "norway_id_portal",
    "pickupLocation": {
      "branchId": "nordby-main",
      "sections": [
        {
          "id": "nordby-main-children",
          "type": "department"
        }
      ]
    }
  }),
});
const data = await response.json();
```

**Python**

```python
import os
import requests

response = requests.post(
    f"{os.environ['PLAS_BASE_URL']}/patron/registration/identity-provider",
    params={
        "version": "0.6.6",
    },
    headers={
        "Accept": "application/json",
        "Content-Type": "application/json",
        "Authorization": f"Bearer {os.environ['PLAS_TOKEN']}",
    },
    json={
        "code": "SplxlOBeZQQYbYS6WxSbIA",
        "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk",
        "consents": [
            {
                "type": "loan_history",
                "version": "2025-01",
            },
        ],
        "identity_provider": "norway_id_portal",
        "pickupLocation": {
            "branchId": "nordby-main",
            "sections": [
                {
                    "id": "nordby-main-children",
                    "type": "department",
                },
            ],
        },
    },
)
data = response.json()
```

The host and token are environment variables: `PLAS_BASE_URL` the provider’s base URL · `PLAS_TOKEN` an access token.

### Parameters

Shared across operations: `version`. [See the shared contract on the version page.](https://plasapi.com/provider/v0.6.6/)

### Request body

`application/json` · required

[`RegisterPatronByCodeAndCodeVerifierRequestBody`](https://plasapi.com/provider/v0.6.6/schemas/#RegisterPatronByCodeAndCodeVerifierRequestBody)

### Responses

#### `200` Success

`PatronRegistrationByCodeAndCodeVerifierResponseBody`

Example (Generated from the schema):

```json
{
  "message": "I accept the library’s terms of use.",
  "patronId": "40218873",
  "status": "done"
}
```

#### `400` The list of errors.

`Errors`

Shared response, defined once for the whole API. [See the shared contract on the version page.](https://plasapi.com/provider/v0.6.6/)

Example (Generated from the schema):

```json
{
  "errors": [
    {
      "code": 200103,
      "info": "200103: invalid/unsupported query parameter value"
    }
  ]
}
```

#### `401` Bearer token invalid, missing, or expired.

No response body.

Shared response, defined once for the whole API. [See the shared contract on the version page.](https://plasapi.com/provider/v0.6.6/)

## This will tell if it is possible to register a new patron, using the given identifier.

`POST` `/patron/registration/possible` · `IsPatronRegistrationPossible`

This will tell if it is possible to register a new patron, using the given identifier.  
The patron can then be registered through `POST /patron/registration/identifier`.


### Example request

**cURL**

```bash
curl -X POST "$PLAS_BASE_URL/patron/registration/possible?version=0.6.6" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $PLAS_TOKEN" \
  -d '{
  "identifier": {
    "type": "local",
    "value": "N00012345"
  },
  "password": "correct-horse-battery"
}'
```

**JavaScript**

```javascript
const response = await fetch(`${process.env.PLAS_BASE_URL}/patron/registration/possible?version=0.6.6`, {
  method: "POST",
  headers: {
    "Accept": "application/json",
    "Content-Type": "application/json",
    "Authorization": `Bearer ${process.env.PLAS_TOKEN}`,
  },
  body: JSON.stringify({
    "identifier": {
      "type": "local",
      "value": "N00012345"
    },
    "password": "correct-horse-battery"
  }),
});
const data = await response.json();
```

**Python**

```python
import os
import requests

response = requests.post(
    f"{os.environ['PLAS_BASE_URL']}/patron/registration/possible",
    params={
        "version": "0.6.6",
    },
    headers={
        "Accept": "application/json",
        "Content-Type": "application/json",
        "Authorization": f"Bearer {os.environ['PLAS_TOKEN']}",
    },
    json={
        "identifier": {
            "type": "local",
            "value": "N00012345",
        },
        "password": "correct-horse-battery",
    },
)
data = response.json()
```

The host and token are environment variables: `PLAS_BASE_URL` the provider’s base URL · `PLAS_TOKEN` an access token.

### Parameters

Shared across operations: `version`. [See the shared contract on the version page.](https://plasapi.com/provider/v0.6.6/)

### Request body

`application/json` · required

[`IsPatronRegistrationPossibleRequestBody`](https://plasapi.com/provider/v0.6.6/schemas/#IsPatronRegistrationPossibleRequestBody)

### Responses

#### `200` Success

`IsPatronRegistrationPossibleResponseBody`

Example (Generated from the schema):

```json
{
  "registries": [
    {
      "type": "norway_national_library_card"
    }
  ]
}
```

#### `400` The list of errors.

`Errors`

Shared response, defined once for the whole API. [See the shared contract on the version page.](https://plasapi.com/provider/v0.6.6/)

Example (Generated from the schema):

```json
{
  "errors": [
    {
      "code": 200103,
      "info": "200103: invalid/unsupported query parameter value"
    }
  ]
}
```

#### `401` Bearer token invalid, missing, or expired.

No response body.

Shared response, defined once for the whole API. [See the shared contract on the version page.](https://plasapi.com/provider/v0.6.6/)
