Back to top

Abomics Pharmacogenetics API

API versions

The API version used by the client is given by the first element in the HTTP request path. If the API should have differences between versions, the service provides request/response pairs given the version the client specifies. The version component of the path will be /v2/ unless specified otherwise.

Server instances

The production server resides at https://pgx.abomics.fi. The test server (recommended for development) resides at https://pgx-test.abomics.fi. For details on test patients to use the API with, contact Abomics.

Code example below use the production server URL; use the test server URL instead when appropriate. The API endpoint paths are identical.

Application identification

API client applications should use the User-Agent HTTP field to identify themselves to the server. The information is used to gather up statistics and information on the performance on a given application. Use the following identifiers for the clients: Abomics/<Client> <major.minor.build>, where Client is assigned by Abomics, and the version number is the internal version number of the client’s API client (or 1.0.0 if no versioning scheme is used).

Example: User-Agent: Abomics/ExampleLabCorp 1.0.3

In addition the requests are identified and verified with SSL Client Certificates that are provided for the client from Abomics. The certification process goes roughly as follows:

  1. The Client creates a certificate key and a CSR (certification signing request) based on that key, using e.g. OpenSSL. The CN (Common Name) field in the CSR will be provided by Abomics. This CSR file is sent to Abomics.

    • By request, Abomics can produce the key and CSR on the Client’s behalf.
  2. Abomics signs a new SSL certificate and sends it to the Client.

  3. The Client uses SSL Client Authentication with this key to authenticate with the API server.

The same certificates can be used with both test and production servers, unless otherwise specified by Abomics.

User identification

For auditing purposes the requests made to the system are stored along with basic information about the requester. The requests need to contain the following custom HTTP headers:

  • User-Id should contain the identity of the current API client user.

    • Example: User-Id: jane.doe@examplelabcorp.com
  • Organization-Id should contain the organization of the current API client user.

    • Example: Organization-Id: ExampleLabCorp

Details on these will be provided by Abomics.

Common datatypes and API conventions

The localization for the server messages are handled by the Accept-Language HTTP header. Currently supported language codes are fi, en, de, sv, et, fr, ro and nl. The application may send the Accept-Language header on every request. However if it is omitted or it is outside of the known values, en is used as the default. The supported locales are FI, GB, DE, AT, SE, EE, FR, RO and NL. You should be able to freely combine languages and locales if necessary, but often it’s best to use “known” pairs like fi-FI or de-AT.

Note that you can also specify the language and locale in the URL path of many of the API calls themselves. These will override the Accept-Language header. The locale choice may have no practical effect on the output, depending on the type of data returned by the API endpoints.

The responses are specified with a HTTP Status code indicating the status of the performed operation. The response specifications show the given HTTP status code in the comment preceding the response definition.

The error codes that are possible outcomes from a request are specified in the documentation. These cases must be handled gracefully by the client.

Drug information

Pharmacogenetic classification

Pharmacogenetic classification
GET/{version}/classification/{locale}/{type}/{term}

Search for drug-specific pharmacogenetic classification, the clinical relevance of genetic variation in the safety and efficacy of the given drug.

Example URI

GET https://pgx.abomics.fi/v2/classification/en-GB/substance/Clopidogrel
URI Parameters
HideShow
version
string (required) Example: v2
locale
string (required) Example: en-GB

The result language and locale.

type
enum (required) Example: substance

Choices: substance tradename inn vnr

term
string (required) Example: Clopidogrel

The search term that is used to search among the items specified by the type parameter.

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "inn": "Clopidogrel",
  "name": {
    "language": "en",
    "name": "Clopidogrel"
  },
  "genetic_flag": "D"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "inn": {
      "type": "string"
    },
    "name": {
      "type": "object",
      "properties": {
        "language": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      }
    },
    "genetic_flag": {
      "type": "string",
      "enum": [
        "A",
        "B",
        "C",
        "D",
        "0"
      ]
    }
  }
}
Response  404

Recommendations

Recommendations
GET/{version}/recommendation/{locale}/{type}/{term}

Search for pharmacogenomic recommendations for all phenotypes for a given drug. The recommendations are returned in the order of their respective relevance.

Example URI

GET https://pgx.abomics.fi/v2/recommendation/en-GB/substance/Clopidogrel
URI Parameters
HideShow
version
string (required) Example: v2
locale
string (required) Example: en-GB

The result language and locale.

type
enum (required) Example: substance

Choices: substance tradename inn vnr

term
string (required) Example: Clopidogrel

The search term that is used to search among the items specified by the type parameter.

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "inn": "Clopidogrel",
  "active_ingredient_ids": [
    {
      "type": "generx",
      "id": 5662
    },
    {
      "type": "kela",
      "id": 5662
    }
  ],
  "name": {
    "language": "en",
    "name": "Clopidogrel"
  },
  "atc_codes": [
    "B01AC04"
  ],
  "recommendations": {
    "CYP2C19": [
      {
        "phenotype_code": "PM",
        "phenotype_name": "PM Poor Metabolizer",
        "recom_grade": "D",
        "text": {
          "language": "en",
          "text": "Recommendation text"
        }
      },
      {
        "phenotype_code": "IM",
        "phenotype_name": "IM Intermediate Metabolizer",
        "recom_grade": "C",
        "text": {
          "language": "en",
          "text": "Recommendation text"
        }
      },
      {
        "phenotype_code": "NM",
        "phenotype_name": "NM Normal Metabolizer",
        "recom_grade": "B",
        "text": {
          "language": "en",
          "text": "Recommendation text"
        }
      },
      {
        "phenotype_code": "UM",
        "phenotype_name": "UM Ultrarapid Metabolizer",
        "recom_grade": "A",
        "text": {
          "language": "en",
          "text": "Recommendation text"
        }
      },
      {
        "phenotype_code": "NA",
        "phenotype_name": "NA Unknown Metabolizer",
        "recom_grade": "NA",
        "text": {
          "language": "en",
          "text": "Recommendation text"
        }
      }
    ],
    "CYP2C9": [
      {
        "phenotype_code": "PM",
        "phenotype_name": "PM Poor Metabolizer",
        "recom_grade": "D",
        "text": {
          "language": "en",
          "text": "Recommendation text"
        }
      },
      {
        "phenotype_code": "IM",
        "phenotype_name": "IM Intermediate Metabolizer",
        "recom_grade": "C",
        "text": {
          "language": "en",
          "text": "Recommendation text"
        }
      },
      {
        "phenotype_code": "NM",
        "phenotype_name": "NM Normal Metabolizer",
        "recom_grade": "B",
        "text": {
          "language": "en",
          "text": "Recommendation text"
        }
      },
      {
        "phenotype_code": "UM",
        "phenotype_name": "UM Ultrarapid Metabolizer",
        "recom_grade": "A",
        "text": {
          "language": "en",
          "text": "Recommendation text"
        }
      },
      {
        "phenotype_code": "NA",
        "phenotype_name": "NA Unknown Metabolizer",
        "recom_grade": "NA",
        "text": {
          "language": "en",
          "text": "Recommendation text"
        }
      }
    ]
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "inn": {
      "type": "string"
    },
    "active_ingredient_ids": {
      "type": "array"
    },
    "name": {
      "type": "object",
      "properties": {
        "language": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      }
    },
    "atc_codes": {
      "type": "array"
    },
    "recommendations": {
      "type": "object",
      "properties": {
        "key": {
          "type": "array"
        }
      }
    }
  }
}
Response  404

Patient information

Complete pharmacogenetic report

Complete pharmacogenetic report
GET/{version}/patient/{id}/report/{locale}/{type}

Note: the activity_score attribute found in the examples shows up as null, due to limitations of our API documentation generation tool, but is actually either null or a decimal number like 2.0.

Example URI

GET https://pgx.abomics.fi/v2/patient/1234/report/en-GB/json
URI Parameters
HideShow
version
string (required) Example: v2
  • v3 version of the endpoint adds fields url and pin_code to summary
id
string (required) Example: 1234
  • sample_id - The patient sample ID to get the data for

  • identity_code - The Personal identity code (supported in Finland)

locale
string (required) Example: en-GB

The result language and locale.

type
enum (required) Example: json

Choices: json pdf

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "summary": {
    "test_date": "2017-01-05",
    "sample_id": "12345_A",
    "cust_sample_id": "1322087",
    "test_provider": "Yhtyneet Medix Laboratoriot",
    "birthday": "1982-09-11",
    "gender": "F",
    "significant_drugs": 1,
    "significant_genes": [
      "CYP2D6",
      "CYP2C19"
    ],
    "genes": 10
  },
  "drugs": [
    {
      "inn": "Clopidogrel",
      "name": {
        "language": "en",
        "name": "Clopidogrel"
      },
      "genetic_flag": "D"
    }
  ],
  "results": [
    {
      "gene": "CYP2D6",
      "genotype": "*1/*2",
      "phenotype": "UM",
      "phenotype_name": "Ultrarapid Metabolizer",
      "description": "CYP2B6 is a liver enzyme. There...",
      "snp_count": [
        "{\"analyzed\": 3",
        "\"total\": 3}"
      ]
    }
  ],
  "recommendations": [
    {
      "inn": "Clopidogrel",
      "name": {
        "language": "en",
        "name": "Clopidogrel"
      },
      "genes": {
        "CYP2C19": [
          {
            "phenotype_code": "PM",
            "phenotype_name": "PM Poor Metabolizer",
            "activity_score": null,
            "recom_grade": "D",
            "text": {
              "language": "en",
              "text": "Recommendation text"
            }
          }
        ],
        "CYP2C9": [
          {
            "phenotype_code": "PM",
            "phenotype_name": "PM Poor Metabolizer",
            "activity_score": null,
            "recom_grade": "D",
            "text": {
              "language": "en",
              "text": "Recommendation text"
            }
          }
        ]
      }
    },
    {
      "inn": "Amitriptyline",
      "name": {
        "language": "en",
        "text": "Amitriptyline"
      },
      "genes": {
        "CYP2D6": [
          {
            "phenotype_code": "PM",
            "phenotype_name": "PM Poor Metabolizer",
            "recom_grade": "D",
            "text": {
              "language": "en",
              "text": "Recommendation text"
            }
          }
        ],
        "CYP2C19": [
          {
            "phenotype_code": "PM",
            "phenotype_name": "PM Poor Metabolizer",
            "recom_grade": "D",
            "text": {
              "language": "en",
              "text": "Recommendation text"
            }
          }
        ]
      }
    }
  ],
  "snp_data": {
    "rs": "rs16947",
    "genotype": "A/G",
    "assay": "ABC1234",
    "gene": "CYP2D6"
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "summary": {
      "type": "object",
      "properties": {
        "test_date": {
          "type": "string"
        },
        "sample_id": {
          "type": "string"
        },
        "cust_sample_id": {
          "type": "string"
        },
        "test_provider": {
          "type": "string"
        },
        "birthday": {
          "type": "string"
        },
        "gender": {
          "type": "string",
          "enum": [
            "F",
            "M",
            "O"
          ]
        },
        "significant_drugs": {
          "type": "number"
        },
        "significant_genes": {
          "type": "array"
        },
        "genes": {
          "type": "number"
        }
      }
    },
    "drugs": {
      "type": "array"
    },
    "results": {
      "type": "array"
    },
    "recommendations": {
      "type": "array"
    },
    "snp_data": {
      "type": "object",
      "properties": {
        "rs": {
          "type": "string"
        },
        "genotype": {
          "type": "string"
        },
        "assay": {
          "type": "string"
        },
        "gene": {
          "type": "string"
        }
      },
      "required": [
        "rs",
        "genotype"
      ]
    }
  }
}
Response  404

Pharmacogenetic report summary

Pharmacogenetic report summary
GET/{version}/patient/{id}/report_summary/{recipient_type}/{locale}

Example URI

GET https://pgx.abomics.fi/v2/patient/1234/report_summary/doctor/en-GB
URI Parameters
HideShow
version
string (required) Example: v2
id
string (required) Example: 1234
  • sample_id - The patient sample ID to get the data for

  • identity_code - The Personal identity code (supported in Finland)

locale
string (required) Example: en-GB

The result language and locale.

recipient_type
enum (required) Example: doctor

Choices: doctor patient

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "summary": "Detailed drug-specific recommendations shall be read from https://my.geneaccount.com/123456\\nPIN code to open the report: 1234.",
  "login_url": "https://my.geneaccount.com/123456",
  "pin_code": "1234"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "summary": {
      "type": "string"
    },
    "login_url": {
      "type": "string"
    },
    "pin_code": {
      "type": "string"
    }
  }
}
Response  404

Drug specific recommendation

Drug specific recommendation
GET/{version}/patient/{id}/recommendation/{locale}/{type}/{term}?{detail}

Gets the drug specific recommendations for the given patient.

There are multiple different possible 404 error responses. Most of them come with a type key that differentiate between the various causes. Only in cases of unforeseen errors should a 404 with no type be generated.

The defined error type keys are:

  • NO_SUBSTANCE: the requested type was substance, but a substance matching term was not found.

  • NO_TRADENAME: the requested type was tradename, but a trade name matching term was not found.

  • NO_INN: the requested type was inn, but an INN matching term was not found.

  • NO_PATIENT: a patient with the given identifier (sample ID or person ID) was not found.

  • NOT_READY: the patient’s test results cannot yet be used for recommendations.

Note: the activity_score attribute found in the examples shows up as null, due to limitations of our API documentation generation tool, but is actually either null or a decimal number like 2.0.

Example URI

GET https://pgx.abomics.fi/v2/patient/1234/recommendation/en-GB/substance/Clopidogrel?detail=default
URI Parameters
HideShow
version
string (required) Example: v2
id
string (required) Example: 1234
  • sample_id - The patient sample ID to get the data for

  • identity_code - The Personal identity code (supported in Finland)

locale
string (required) Example: en-GB

The locale to be used for searching. The country and language may be both used, or only one of them depending on the search type.

type
enum (required) Example: substance

Choices: substance tradename inn

term
string (required) Example: Clopidogrel

The search term that is used to search among the items in specified by the type parameter.

detail
string (optional) Example: detail=default

With query parameter omitted or detail=default, returns only recom_grade and text. With detail=gene, response includes additionally test date, phenotype code, phenotype name and description text for the gene

Request  without query parameters
HideShow
Headers
Accept: application/json
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "CYP2C19": {
    "recom_grade": "D",
    "text": {
      "language": "en",
      "text": "Recommendation text for CYP2C19"
    }
  },
  "CYP2C9": {
    "recom_grade": "C",
    "text": {
      "language": "en",
      "text": "Recommendation text for CYP2C9"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "key": {
      "type": "object",
      "properties": {
        "recom_grade": {
          "type": "string"
        },
        "text": {
          "type": "object",
          "properties": {
            "language": {
              "type": "string"
            },
            "text": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}
Request  with query parameter ?details=gene
HideShow
Headers
Accept: application/json
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "CYP2C19": {
    "recom_grade": "D",
    "test_date": "2024-01-01",
    "phenotype_code": "UM",
    "phenotype_name": "UM Ultrarapid Metabolizer",
    "activity_score": "Hello, world!",
    "text": {
      "language": "en",
      "text": "Recommendation text for CYP2C19"
    },
    "gene_text": {
      "language": "en",
      "text": "General description text for CYP2C19"
    }
  },
  "CYP2C9": {
    "recom_grade": "C",
    "test_date": "2024-01-01",
    "phenotype_code": "NM",
    "phenotype_name": "NM Normal Metabolizer",
    "activity_score": "Hello, world!",
    "text": {
      "language": "en",
      "text": "Recommendation text for CYP2C9"
    },
    "gene_text": {
      "language": "en",
      "text": "General description text for CYP2C9"
    }
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "key": {
      "type": "object",
      "properties": {
        "recom_grade": {
          "type": "string"
        },
        "test_date": {
          "type": "string",
          "format": "date"
        },
        "phenotype_code": {
          "type": "string"
        },
        "phenotype_name": {
          "type": "string"
        },
        "activity_score": {
          "type": "number"
        },
        "text": {
          "type": "object",
          "properties": {
            "language": {
              "type": "string"
            },
            "text": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}
Response  404
HideShow
Headers
Content-Type: application/json
Body
{
  "errors": [
    {
      "data": "Patient with ID \"171081-9419\" not found.",
      "type": "NO_PATIENT"
    }
  ]
}

Multi-substance drug specific recommendation

Multi-substance drug specific recommendation
POST/{version}/patient/{id}/recommendation/{locale}/multi-substance/?{detail}

Gets the drug specific recommendations for the given patient, supporting multiple search terms in a single query. Only supports substance queries.

The result is a list of objects, grouped by gene and grade. In the example responses below, an object with "gene": "CYP2C9" appears twice, with a single affected substance in each, because the recommendation grades are different for the respective substances. The CYP2D6 object, on the other hand, appears just once, with two affected substances, since the grade is the same for both substances.

There are two different possible 404 error responses. Only in cases of unforeseen errors should a 404 with no type be generated.

The defined error type keys are:

  • NO_SUBSTANCE: the requested type was substance, but one or more substances queried were not found.

  • NOT_READY: the patient’s test results cannot yet be used for recommendations.

Note: the activity_score attribute found in the examples shows up as null, due to limitations of our API documentation generation tool, but is actually either null or a decimal number like 2.0.

Example URI

POST https://pgx.abomics.fi/v2/patient/1234/recommendation/en-GB/multi-substance/?detail=default
URI Parameters
HideShow
version
string (required) Example: v2
id
string (required) Example: 1234
  • sample_id - The patient sample ID to get the data for

  • identity_code - The Personal identity code (supported in Finland)

locale
string (required) Example: en-GB

The locale to be used for searching. The country and language may be both used, or only one of them depending on the search type.

detail
string (optional) Example: detail=default

With query parameter omitted or detail=default, returns only recom_grade and text. With detail=gene, response includes additionally test date, phenotype code, phenotype name and description text for the gene

Request  without query parameters
HideShow
Headers
Accept: application/json
Body
{
  "terms": [
    "warfarin",
    "ibuprofen",
    "codeine",
    "semaglutide"
  ]
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "gene": "CYP2C9",
    "recom_grade": "C",
    "affected_substances": [
      "warfarin"
    ],
    "text": {
      "language": "en",
      "text": "..."
    }
  },
  {
    "gene": "CYP2C9",
    "recom_grade": "A",
    "affected_substances": [
      "ibuprofen"
    ],
    "text": {
      "language": "en",
      "text": "..."
    }
  },
  {
    "gene": "CYP2D6",
    "recom_grade": "B",
    "affected_substances": [
      "codeine",
      "semaglutide"
    ],
    "text": {
      "language": "en",
      "text": "..."
    }
  }
]
Request  with query parameter ?details=gene
HideShow
Headers
Accept: application/json
Body
{
  "terms": [
    "warfarin",
    "ibuprofen",
    "codeine",
    "semaglutide"
  ]
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "gene": "CYP2C9",
    "recom_grade": "C",
    "affected substances": [
      "warfarin"
    ],
    "text": {
      "language": "en",
      "text": "..."
    },
    "test_date": "2024-01-01",
    "phenotype_code": "UM",
    "phenotype_name": "UM Ultrarapid Metabolizer",
    "activity_score": null,
    "gene_text": {
      "language": "en",
      "text": "..."
    }
  },
  {
    "gene": "CYP2C9",
    "recom_grade": "A",
    "affected substances": [
      "ibuprofen"
    ],
    "text": {
      "language": "en",
      "text": "..."
    },
    "test_date": "2024-01-01",
    "phenotype_code": "UM",
    "phenotype_name": "UM Ultrarapid Metabolizer",
    "activity_score": null,
    "gene_text": {
      "language": "en",
      "text": "..."
    }
  },
  {
    "gene": "CYP2D6",
    "recom_grade": "B",
    "affected substances": [
      "codeine",
      "semaglutide"
    ],
    "text": {
      "language": "en",
      "text": "..."
    },
    "test_date": "2024-01-01",
    "phenotype_code": "NM",
    "phenotype_name": "NM Normal Metabolizer",
    "activity_score": null,
    "gene_text": {
      "language": "en",
      "text": "..."
    }
  }
]
Response  404
HideShow
Headers
Content-Type: application/json
Body
{
  "errors": [
    {
      "data": "No substance(s) found for \"ipubrofen\", \"coneide\".",
      "type": "NO_SUBSTANCE"
    }
  ]
}

Data import

SNP Data import

SNP Data import
POST/snpdata

Not yet available.

Example URI

POST https://pgx.abomics.fi/snpdata
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "batch_id": "ABC123",
  "date": "2017-01-20T10:10:00+0200",
  "test_id": 12345,
  "comment": "Comments about the test",
  "data": [
    {
      "sample_id": "12345_A",
      "birthday": "1982-09-11",
      "gender": "F",
      "snp": [
        {
          "rs": "rs16947",
          "genotype": "A/G",
          "assay": "ABC1234",
          "gene": "CYP2D6"
        }
      ],
      "cnv": [
        {
          "gene": "CYP2D6",
          "cnv": 2
        }
      ]
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "batch_id": {
      "type": "string"
    },
    "date": {
      "type": "string"
    },
    "test_id": {
      "type": "number"
    },
    "comment": {
      "type": "string"
    },
    "data": {
      "type": "array"
    }
  },
  "required": [
    "batch_id",
    "date",
    "data"
  ]
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "queued_data_count": 10,
  "errors": [
    {
      "text": "BatchSample '123' failed schema validation"
    }
  ],
  "warnings": [
    {
      "text": "BatchSample may contain duplicate values"
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "queued_data_count": {
      "type": "number"
    },
    "errors": {
      "type": "array"
    },
    "warnings": {
      "type": "array"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "validation_error": [
    {
      "name": "batch.id",
      "error_message": "this field is required"
    }
  ]
}

Generated by aglio on 03 Jul 2025