> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.elacity.ai/llms.txt.
> For full documentation content, see https://docs.elacity.ai/llms-full.txt.

# Publish artifact version

POST /api/registries/artifacts
Content-Type: application/json

Publish a new artifact version to a registry

Reference: https://docs.elacity.ai/api-reference/elacity-prm-api/registries/prm-registry-publish

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: openapi
  version: 1.0.0
paths:
  /registries/artifacts:
    post:
      operationId: prm-registry-publish
      summary: Publish artifact version
      description: Publish a new artifact version to a registry
      tags:
        - subpackage_registries
      parameters:
        - name: X-API-Key
          in: header
          description: API key for programmatic access
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Registries_prm.registry.publish_Response_200
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                registryRef:
                  type: string
                artifact:
                  $ref: >-
                    #/components/schemas/RegistriesArtifactsPostRequestBodyContentApplicationJsonSchemaArtifact
              required:
                - registryRef
                - artifact
servers:
  - url: /api
components:
  schemas:
    RegistriesArtifactsPostRequestBodyContentApplicationJsonSchemaArtifactSchema:
      type: object
      properties:
        input:
          type: string
        output:
          type: string
      title: >-
        RegistriesArtifactsPostRequestBodyContentApplicationJsonSchemaArtifactSchema
    RegistriesArtifactsPostRequestBodyContentApplicationJsonSchemaArtifact:
      type: object
      properties:
        prompt:
          type: string
        version:
          type: string
        model:
          type: string
        body:
          type: string
        compiled:
          type: string
        hash:
          type: string
        schema:
          $ref: >-
            #/components/schemas/RegistriesArtifactsPostRequestBodyContentApplicationJsonSchemaArtifactSchema
        components:
          type: object
          additionalProperties:
            type: string
        tools:
          type: object
          additionalProperties:
            type: string
        metadata:
          type: object
          additionalProperties:
            description: Any type
      required:
        - prompt
        - version
        - model
        - compiled
        - hash
        - schema
        - components
        - metadata
      title: RegistriesArtifactsPostRequestBodyContentApplicationJsonSchemaArtifact
    Registries_prm.registry.publish_Response_200:
      oneOf:
        - description: Any type
        - description: Any type
      title: Registries_prm.registry.publish_Response_200
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key for programmatic access

```

## SDK Code Examples

```python
import requests

url = "https://api/registries/artifacts"

payload = {
    "registryRef": "string",
    "artifact": {
        "prompt": "string",
        "version": "string",
        "model": "string",
        "compiled": "string",
        "hash": "string",
        "schema": {},
        "components": {},
        "metadata": {}
    }
}
headers = {
    "X-API-Key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api/registries/artifacts';
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"registryRef":"string","artifact":{"prompt":"string","version":"string","model":"string","compiled":"string","hash":"string","schema":{},"components":{},"metadata":{}}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api/registries/artifacts"

	payload := strings.NewReader("{\n  \"registryRef\": \"string\",\n  \"artifact\": {\n    \"prompt\": \"string\",\n    \"version\": \"string\",\n    \"model\": \"string\",\n    \"compiled\": \"string\",\n    \"hash\": \"string\",\n    \"schema\": {},\n    \"components\": {},\n    \"metadata\": {}\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-API-Key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api/registries/artifacts")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"registryRef\": \"string\",\n  \"artifact\": {\n    \"prompt\": \"string\",\n    \"version\": \"string\",\n    \"model\": \"string\",\n    \"compiled\": \"string\",\n    \"hash\": \"string\",\n    \"schema\": {},\n    \"components\": {},\n    \"metadata\": {}\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api/registries/artifacts")
  .header("X-API-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"registryRef\": \"string\",\n  \"artifact\": {\n    \"prompt\": \"string\",\n    \"version\": \"string\",\n    \"model\": \"string\",\n    \"compiled\": \"string\",\n    \"hash\": \"string\",\n    \"schema\": {},\n    \"components\": {},\n    \"metadata\": {}\n  }\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api/registries/artifacts', [
  'body' => '{
  "registryRef": "string",
  "artifact": {
    "prompt": "string",
    "version": "string",
    "model": "string",
    "compiled": "string",
    "hash": "string",
    "schema": {},
    "components": {},
    "metadata": {}
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-Key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api/registries/artifacts");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"registryRef\": \"string\",\n  \"artifact\": {\n    \"prompt\": \"string\",\n    \"version\": \"string\",\n    \"model\": \"string\",\n    \"compiled\": \"string\",\n    \"hash\": \"string\",\n    \"schema\": {},\n    \"components\": {},\n    \"metadata\": {}\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-API-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "registryRef": "string",
  "artifact": [
    "prompt": "string",
    "version": "string",
    "model": "string",
    "compiled": "string",
    "hash": "string",
    "schema": [],
    "components": [],
    "metadata": []
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api/registries/artifacts")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```