# How to upload an image using Photo API

Source: https://docs.arcxp.com/en/knowledge-articles/photo-center/how-to-upload-an-image-using-photo-api.html

## Summary

Here are different examples to upload a new photo using Photo API

## Procedure

**1: Arc XP Native Specification (ANS) from file, no ID**

```
curl --request POST \
  --url https://api.{{org}}.arcpublishing.com/photo/api/v2/photos \
  --header 'Authorization: Bearer ' \
  --header 'Content-Type: multipart/form-data' \
  --form ans=@/Users/test/Documents/photo_ans_test.json
```

**2: ANS from file, ID in ANS, no ID in URL path**

```
curl --request POST \
  --url https://api.{{org}}.arcpublishing.com/photo/api/v2/photos \
  --header 'Authorization: Bearer ' \
  --header 'Content-Type: multipart/form-data' \
  --form ans=@/Users/test/Documents/photo_ans_test2.json
```

**3: ANS from file ID in ANS, ID in URL path**

```
curl --request POST \
  --url https://api.{{org}}.arcpublishing.com/photo/api/v2/photos/B3BTTESTNAWNYEUP2VOBDINLPI \
  --header 'Authorization: Bearer ' \
  --header 'Content-Type: multipart/form-data' \
  --form ans=@/Users/test/Documents/photo_ans_test3.json
```

**4: ANS from JSON, ID in ANS, ID in URL path**

```
curl --request POST \
  --url 'https://api.{{org}}.arcpublishing.com/photo/api/v2/photos/B4BTTESTNAWNYEUP2VOBDINLPI?=' \
  --header 'Authorization: Bearer ' \
  --header 'Content-Type: application/json' \
  --data '{
    "_id": "B4BTTESTNAWNYEUP2VOBDINLPI",
    "version": "0.10.7",
    "type": "image",
    "owner": {
        "id": "{{org}}"
    },
    "additional_properties": {
        "originalUrl": "https://images.unsplash.com/photo-1654452698901-cf57845dd7a7"
   }
}'
```

**5: ANS from JSON, no ID in ANS**

```
curl --request POST \
  --url 'https://api.{{org}}.arcpublishing.com/photo/api/v2/photos' \
  --header 'Authorization: Bearer ' \
  --header 'Content-Type: application/json' \
  --data '{
    "version": "0.10.10",
    "type": "image",
    "owner": {
        "id": "{{org}}"
    },
    "additional_properties": {
        "originalUrl": "https://images.unsplash.com/photo-1654452698901-cf57845dd7a7"
   }
}'
```

## More Information

| • [Arc XP Photo API Documentation](https://dev.arcxp.com/api/content-administration/photo-api/)• [How to write the minimum ANS for a viable image document](https://dev.arcxp.com/concepts/content-model-ans/minimum-ans-for/minimum-ans-for-a-viable-image-document/) |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
