---
title: "Create SVG"
method: POST
path: "/{country}/{version}/{level}/svg"
tags: ["Regions"]
---

# Create SVG

`POST /{country}/{version}/{level}/svg`

Create an svg from a set of layers defined by regions.

## Path parameters

- `country` string, required
- `version` string, required
- `level` string, required

## Request body

- object
  - `width` integer, required
  - `height` integer, required
  - `codes` union
    - union[]
      - union
        - string
        - integer
    - object
  - `style` object
  - `fgLayers` object[] — Drawn front to back (first in front, last in back). Foreground layers are drawn in front of the base request layer and background layers. Non-renderable regions will not be included in the SVG layer. If the primary layer is not renderable the bottom-most renderable layer of the SVG will be chosen as the primary layer instead.
    - `level` string, required
    - `style` object
    - `codes` union[]
      - union
        - string
        - integer
    - `primary` boolean — Indicate this is the primary layer, setting the SVG view box to this layer. If multiple layers are set to primary the top most layer will be chosen (this includes foreground and background layers). If no layer is set to primary the base request layer will be used.
  - `bgLayers` object[] — Drawn front to back (first in front, last in back). Background layers are drawn behind the foreground layers and base request layer. Non-renderable regions will not be included in the SVG layer. If the primary layer is not renderable the bottom-most renderable layer of the SVG will be chosen as the primary layer instead.
    - `level` string, required
    - `style` object
    - `codes` union[]
      - union
        - string
        - integer
    - `primary` boolean — Indicate this is the primary layer, setting the SVG view box to this layer. If multiple layers are set to primary the top most layer will be chosen (this includes foreground and background layers). If no layer is set to primary the base request layer will be used.
  - `choroplethFill` object — Only applies if `codes` is an object of values keyed to their respective codes. The values will be normalized to their respective fill color based on if they are `positive`, `zero`, or `negative`. These values will overwrite any `style` fill specified.
    - `positive` unknown[]
      - unknown
    - `zero` string
    - `negative` unknown[]
      - unknown
    - `algorithm` 'natural_break' | 'quantile' | 'linear' — * `natural_break` – Bucket around natural breaks in the data. * `quantile` – Bucket data into approximately equal sized groups. * `linear` – Bucket data on a linear scale.

## Response `200`

SVG paths are dynamically simplified based on rendered area to reduce response size.
The more zoomed out you are, or the smaller your canvas is, the more simplified the SVG paths will
be. Also, to save space, regions that cannot be seen in the viewport will be omitted from the SVG.

## Other responses

- `400` — bad request
- `404` — requested resource not found

---

[API](https://skmtc.net/lightcast/apis/alumni-pathways-2-0.md) · [All operations](https://skmtc.net/lightcast/apis/alumni-pathways-2-0/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/lightcast/alumni-pathways-2-0/revisions/fc66b9877391/schema)
