PUFin ID API (1.0.0)

Download OpenAPI specification:Download

Introduction

This document covers the public available PufinID APIs. The PufinID API is built on HTTP. It returns HTTP response codes to indicate errors. It accepts and return JSON in the http body.

Authentication

Many API endpoints require authentication. You authenticate your request by sending a token in the Authorization header.

The API supports JWT tokens and you must use authorization: Bearer. If you try to use an endpoint without a token or with a token that has insufficient permission you will receive a 404 Not Found or 403 Forbidden response.

Here is is an example of how tokens are used:

curl -L \
-H "Autherization: Bearer <TOKEN>" \
-H "Content-Type: application/json" \
https://api.pufinid.com/v1/users/me

Note: The token is currently a JWT token but that might change in the future. Because of this do not rely on the information that is encoded in the JWT since it might break in the future. For how to get user information consult the User section.

Obtain token

Obtain a token by authenticate a user based on username and password.

The returned access token must be sent as part of a request for all endpoints that require authentication.

The returned refresh token is used to refresh the access token. The lifetime of each token is dynamic and is returned as part of the response.

Request Body schema: application/json
username
required
string

username

password
required
string

password

Responses

Request samples

Content type
application/json
{
  • "username": "string",
  • "password": "string"
}

Response samples

Content type
application/json
{
  • "access": "string",
  • "refresh": "string",
  • "access_expires_in": 300,
  • "refresh_expires_in": 86400
}

Refresh token

Obtain a new access token based on a refresh token. When short-lived access token expires, the longer-lived refresh token can be used to obtain another access token. This will also set a new expiration time for the access token.

The expiration time for the refresh token stays the same.

Request Body schema: application/json
refresh
required
string

The refresh token.

Responses

Request samples

Content type
application/json
{
  • "refresh": "string"
}

Response samples

Content type
application/json
{
  • "access": "string",
  • "access_expires_in": 0
}

Revoke token

Revokes a refresh token. Refresh token is invalidated and cannot be used anymore to create new access tokens.

Note this does not invalidate any of the access tokens that were created together with or with the refresh token.

Request Body schema:
refresh
required
string

Refresh token to be revoked

Responses

Request samples

Content type
{
  • "refresh": "string"
}

Response samples

Content type
application/json
{
  • "detail": "string",
  • "refresh": [
    ]
}

Verify token

Verify that a token is valid. This can be used both to verify an access token and a refresh token.

Request Body schema: application/json
token
required
string

Token to verify

Responses

Request samples

Content type
application/json
{
  • "token": "string"
}

Response samples

Content type
application/json
{
  • "detail": "string",
  • "token": [
    ]
}

Apps Profile

Get Apps Profile by client id

Get Apps Profile by client id

query Parameters
g
string

group id

id
string

unique id of the qr code

o
required
string

client id

Responses

Response samples

Content type
application/json

Apps profile response

{
  • "config": {
    },
  • "actions": {
    }
}

FAQ Topics

List terms

List all FAQ topics.

query Parameters
limit
integer

Number of results to return per page.

offset
integer

The initial index from which to return the results.

Responses

Response samples

Content type
application/json
{}

Get terms by id

Get a specific topic by id.

path Parameters
id
required
integer

A unique integer value identifying this Topic.

Responses

Response samples

Content type
application/json
{
  • "id": 0,
  • "name": "string",
  • "sort_order": -2147483648,
  • "questions": [
    ]
}

PufDesign

List PUF designs

API endpoint that allows PufDesign to be viewed or edited.

Authorizations:
tokenAuth
query Parameters
limit
integer

Number of results to return per page.

offset
integer

The initial index from which to return the results.

Responses

Response samples

Content type
application/json
{}

Get a PUF design

API endpoint that allows PufDesign to be viewed or edited.

Authorizations:
tokenAuth
path Parameters
id
required
string <uuid>

A UUID string identifying this puf design.

Responses

Response samples

Content type
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "name": "string",
  • "description": "string",
  • "puf_design_type": "string",
  • "organization": "452c1a86-a0af-475b-b03f-724878b0f387",
  • "puf_design_icon_url": "string",
  • "auto_capture_enabled": true
}

Terms

List terms

List all terms a user has to accept before signing up.

If this endpoint is called for an authenticated user, it will list all terms that the user has not accepted yet.

with the query parameter include_all set to true, it will also include terms that has been accepted and when.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get terms by slug

Get a specific term by slug.

Current terms to sign by user creation:

  • /v1/terms/privacy
path Parameters
slug
required
string

Responses

Response samples

Content type
application/json
{
  • "name": "string",
  • "slug": "string",
  • "version_number": 0,
  • "text": "string",
  • "info": "string",
  • "date_active": "2019-08-24T14:15:22Z"
}

Users

Create a user

API endpoint that allows users to be viewed or edited.

Request Body schema:
first_name
required
string [ 2 .. 100 ] characters
last_name
required
string [ 2 .. 100 ] characters
username
string or null [ 2 .. 100 ] characters
email
required
string <email>
password
required
string [ 8 .. 100 ] characters
password_confirm
required
string [ 8 .. 100 ] characters
terms_accepted
Array of strings[ items <= 255 characters ]

A list of all terms a user has accepted upon registration.

all values must be slugs from the Get terms endpoint.

For accepting all terms use the special value * e.g "terms_accepted_description": ["*"].

phone
string or null <= 20 characters
postcode
string or null <= 20 characters
country
string or null <= 20 characters
gender
string or null <= 20 characters
age
string or null <= 20 characters
organization_code
string or null <= 20 characters

Signup for a specific environment.

If organization_code is null, an empty value or not set a user will be signed up for the Demo environment.

If organization_code is set and it matches a code for an environment the user will be signed up for that specific environment.

If organization_code is set but not matched to a code for an environment a 400 response will be returned.

Responses

Request samples

Content type
{
  • "first_name": "string",
  • "last_name": "string",
  • "username": "string",
  • "email": "user@example.com",
  • "password": "stringst",
  • "password_confirm": "stringst",
  • "terms_accepted": [
    ],
  • "phone": "string",
  • "postcode": "string",
  • "country": "string",
  • "gender": "string",
  • "age": "string",
  • "organization_code": "string"
}

Response samples

Content type
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "first_name": "string",
  • "last_name": "string",
  • "username": "string",
  • "email": "user@example.com",
  • "terms_not_accepted": [
    ],
  • "is_verified": true,
  • "phone": "string",
  • "postcode": "string",
  • "country": "string",
  • "gender": "string",
  • "age": "string",
  • "organization_name": "string",
  • "theme": {
    }
}

Get a user

Get user details. To get user details for the authenticated user you can use me as the {id}.

Authorizations:
tokenAuth
path Parameters
id
required
string <uuid>

A UUID string identifying this user.

Responses

Response samples

Content type
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "first_name": "string",
  • "last_name": "string",
  • "username": "string",
  • "email": "user@example.com",
  • "terms_not_accepted": [
    ],
  • "is_verified": true,
  • "phone": "string",
  • "postcode": "string",
  • "country": "string",
  • "gender": "string",
  • "age": "string",
  • "organization_name": "string",
  • "theme": {
    }
}

Update a user

Update user details. To update user details for the authenticated user you can use me as the {id}.

Authorizations:
tokenAuth
path Parameters
id
required
string <uuid>

A UUID string identifying this user.

Request Body schema:
first_name
required
string or null [ 2 .. 100 ] characters
last_name
required
string or null [ 2 .. 100 ] characters
phone
required
string or null <= 20 characters
postcode
required
string or null <= 20 characters
country
required
string or null <= 20 characters
gender
required
string or null <= 20 characters
age
required
string or null <= 20 characters

Responses

Request samples

Content type
{
  • "first_name": "string",
  • "last_name": "string",
  • "phone": "string",
  • "postcode": "string",
  • "country": "string",
  • "gender": "string",
  • "age": "string"
}

Response samples

Content type
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "first_name": "string",
  • "last_name": "string",
  • "username": "string",
  • "email": "user@example.com",
  • "terms_not_accepted": [
    ],
  • "is_verified": true,
  • "phone": "string",
  • "postcode": "string",
  • "country": "string",
  • "gender": "string",
  • "age": "string",
  • "organization_name": "string",
  • "theme": {
    }
}

Partial Update a user

Partial update user details. To partial update user details for the authenticated user you can use me as the {id}.

Authorizations:
tokenAuth
path Parameters
id
required
string <uuid>

A UUID string identifying this user.

Request Body schema: application/json
first_name
string [ 2 .. 100 ] characters
last_name
string [ 2 .. 100 ] characters
phone
string <= 20 characters
postcode
string <= 20 characters
country
string <= 20 characters
gender
string <= 20 characters
age
string <= 20 characters

Responses

Request samples

Content type
application/json
{
  • "first_name": "string",
  • "last_name": "string",
  • "phone": "string",
  • "postcode": "string",
  • "country": "string",
  • "gender": "string",
  • "age": "string"
}

Response samples

Content type
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "first_name": "string",
  • "last_name": "string",
  • "username": "string",
  • "email": "user@example.com",
  • "terms_not_accepted": [
    ],
  • "is_verified": true,
  • "phone": "string",
  • "postcode": "string",
  • "country": "string",
  • "gender": "string",
  • "age": "string",
  • "organization_name": "string",
  • "theme": {
    }
}

Delete a user

Delete user. To update user details for the authenticated user you can use me as the {id}.

Authorizations:
tokenAuth
path Parameters
id
required
string <uuid>

A UUID string identifying this user.

Responses

Response samples

Content type
application/json
{
  • "non_field_errors": [
    ],
  • "password": [
    ]
}

Confirm user email

Confirm user email.

Request Body schema:
email
required
string <email>
token
required
string >= 20 characters

Responses

Request samples

Content type
{
  • "email": "user@example.com",
  • "token": "stringstringstringst"
}

Response samples

Content type
application/json
{
  • "non_field_errors": [
    ],
  • "email": [
    ],
  • "token": [
    ]
}

Resend confirm user email

Resend confirm email. This requires an email whether user is logged in or not.

Request Body schema:
email
required
string <email>

Responses

Request samples

Content type
{
  • "email": "user@example.com"
}

Response samples

Content type
application/json
{
  • "non_field_errors": [
    ],
  • "email": [
    ]
}

Send reset password email

Send email to user with email with reset password link.

This link will contain a token that will expire within X (TBD).

Request Body schema:
email
required
string

Email that will receive a reset password link.

Responses

Request samples

Content type
{
  • "email": "string"
}

Response samples

Content type
application/json
{
  • "detail": "string",
  • "email": [
    ]
}

Change Password

Update password for the authenticated user.

Authorizations:
tokenAuth
Request Body schema:
old_password
required
string
new_password
required
string >= 8 characters
new_password_confirm
required
string

Responses

Request samples

Content type
{
  • "old_password": "string",
  • "new_password": "stringst",
  • "new_password_confirm": "string"
}

Reset password

Resets a users password.

This endpoint is the last step of the reset password flow. When a user has requested a password reset, he will receive an email with a link that contains email and token as query parameters (See "Send reset password email" for how to trigger the email).

When clicking this link he will be directed to a place where he can enter a new password.

The typed password must be submitted to this endpoint along with the emailandtoken` query paramters.

Request Body schema:
email
required
string <email>

The email received in the reset link.

new_password
required
string >= 8 characters

The new password to be set.

new_password_confirm
required
string

Confirming the new password to be set

token
required
string

The token received in the reset link.

Responses

Request samples

Content type
{
  • "email": "user@example.com",
  • "new_password": "stringst",
  • "new_password_confirm": "string",
  • "token": "string"
}

Response samples

Content type
application/json
{
  • "detail": "string",
  • "email": [
    ],
  • "new_password": [
    ],
  • "new_password_confirm": [
    ],
  • "token": [
    ]
}